简体   繁体   English

自定义排序分析器,用于弹性搜索

[英]Custom sort analyser for Elastic search

How can we sort tokens before indexing to elastic search. 在索引到弹性搜索之前,我们如何排序令牌。 for Eg. 例如 i want to index 我想索引

 "a b" => "ab" 
 "b a" => "ab"
 "java language" => "javalanguage"
 "requirement analysis" => "analysisrequirement"

After sorting we are concatenating all tokens for our use case. 排序后,我们将连接所有用例标记。

How can we achieve this using custom sort analyser?. 我们如何使用自定义排序分析器实现这一目标?

EDIT: so we have applied couple of custom analyser on Elastic search mapping for our use case. 编辑:所以我们在用例的弹性搜索映射上应用了几个自定义分析器。 For eg. 例如。 we have 我们有

token
stemming
custom_words_concatenation

I want to sorting of words using analyser. 我想使用分析器对单词进行排序。 like below, 像下面一样

token
stemming
sort
custom_words_concatenation

Created a custom sort analyzer. 创建了一个自定义的排序分析器。

link github https://github.com/ranjeet-floyd/plugin-sortchar.git 链接github https://github.com/ranjeet-floyd/plugin-sortchar.git

Convert input string to char[] and sort using Arrays.sort . 将输入字符串转换为char []并使用Arrays.sort进行Arrays.sort

For eg: 例如:

requirement analysis  =>  aaeeeiilmnnqrrsstuy
analysis requirement => aaeeeiilmnnqrrsstuy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM