-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support of Elasticsearch Token Filters #16843
Conversation
Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request. If you like Orchard Core, please star our repo and join our community channels. |
@dotnet-policy-service agree |
Could you please check this, @Skrypt? |
@Skrypt what do you think? No problem if not, just please reply. |
I will take look. |
Great, thank you! |
@@ -432,14 +432,15 @@ public async Task<ActionResult> ForceDelete(ElasticIndexSettingsViewModel model) | |||
return RedirectToAction(nameof(Index)); | |||
} | |||
|
|||
public async Task<IActionResult> Mappings(string indexName) | |||
public async Task<IActionResult> IndexInfo(string indexName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this was named Mappings because that's how ElasticSearch calls it in its terminology.
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, need to see what is the difference between GetIndexMappings and GetIndexInfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you send me a screenshot of the resulting textfield in the Admin UI so that I can compare?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
"default_newind": {
"aliases": {},
"mappings": {
"_meta": {
"last_task_id": 0
},
"_source": {
"excludes": [
"Content.ContentItem.DisplayText.Analyzed"
]
},
"dynamic_templates": [
{
"*.Inherited": {
"path_match": "*.Inherited",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
},
{
"*.Ids": {
"path_match": "*.Ids",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
],
"properties": {
"Content": {
"properties": {
"ContentItem": {
"properties": {
"ContainedPart": {
"properties": {
"Ids": {
"type": "keyword"
},
"Order": {
"type": "float"
}
}
},
"ContentType": {
"type": "keyword"
},
"DisplayText": {
"properties": {
"Analyzed": {
"type": "text"
},
"Normalized": {
"type": "keyword"
},
"keyword": {
"type": "keyword"
}
}
},
"FullText": {
"type": "text"
},
"Owner": {
"type": "keyword"
}
}
}
}
},
"ContentItemId": {
"type": "keyword"
},
"ContentItemVersionId": {
"type": "keyword"
}
}
},
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "default_newind",
"creation_date": "1728302642111",
"analysis": {
"filter": {
"russian_stemmer": {
"type": "stemmer",
"language": "russian"
},
"english_stemmer": {
"type": "stemmer",
"language": "russian"
},
"russian_stop": {
"type": "stop",
"stopwords": "_russian_"
},
"russian_synonyms": {
"type": "synonym_graph",
"synonyms": [
"\u0437\u043E\u043B\u043E\u0442\u043E, AU, XAU",
"\u043F\u043E\u0437\u0438\u0446\u0438\u0438, \u0438\u043D\u0442\u0435\u0440\u0435\u0441"
]
},
"english_stop": {
"type": "stop",
"stopwords": "_russian_"
}
},
"analyzer": {
"default": {
"filter": [
"lowercase",
"russian_stop",
"russian_synonyms",
"russian_stemmer",
"english_stop",
"english_stemmer"
],
"type": "custom",
"tokenizer": "standard"
}
}
},
"number_of_replicas": "1",
"uuid": "V-oB0lgQRmWMiKQCJLLLTg",
"version": {
"created": "7160299"
}
}
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, need to see what is the difference between GetIndexMappings and GetIndexInfo.
The difference now, is that shows not only "mappings" section but full index information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for IndexInfo then
@@ -7,4 +7,6 @@ public class ElasticsearchOptions | |||
public string IndexPrefix { get; set; } | |||
|
|||
public Dictionary<string, JsonObject> Analyzers { get; } = []; | |||
|
|||
public Dictionary<string, JsonObject> Filter { get; } = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should leave the name as "Filter", because it is how this section called in elasticsearch terminology.
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html
Settings.Analysis.FIlter and there listed custom token filters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, ok, that's weird but I guess that we can live with it.
@@ -0,0 +1,81 @@ | |||
using System.Text.Json; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I like this code. It is cleaner.
Looking good from first review. Did not test yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved but needs to be tested.
...rdCore.Modules/OrchardCore.Search.Elasticsearch/Extensions/ElasticsearchOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
...rdCore.Modules/OrchardCore.Search.Elasticsearch/Extensions/ElasticsearchOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
...rdCore.Modules/OrchardCore.Search.Elasticsearch/Extensions/ElasticsearchOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
...rdCore.Modules/OrchardCore.Search.Elasticsearch/Extensions/ElasticsearchOptionsExtensions.cs
Outdated
Show resolved
Hide resolved
...rdCore.Modules/OrchardCore.Search.Elasticsearch/Extensions/ElasticsearchOptionsExtensions.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Startup.cs
Outdated
Show resolved
Hide resolved
…sions/ElasticsearchOptionsExtensions.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…sions/ElasticsearchOptionsExtensions.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…sions/ElasticsearchOptionsExtensions.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…sions/ElasticsearchOptionsExtensions.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…sions/ElasticsearchOptionsExtensions.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…up.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
This pull request has merge conflicts. Please resolve those before requesting a review. |
@denispetrische could you please fix the conflict to react to my recent changes in #16896 |
Done |
Congratulations on your first PR merge! 🎉 Thank you for your contribution! We're looking forward to welcoming other contributions of yours in the future. @all-contributors please add @denispetrische for code. If you like Orchard Core, please star our repo and join our community channels. |
@github-actions[bot] I've put up a pull request to add @denispetrische! 🎉 |
Thanks for your contribution @denispetrische |
Fixes #16384
Also:
Now it is available to create analyzers and filters like that: