How to treat each keyword as a prefix in Elastic Search
I am used to FTS techs doing this for me but imagine I input mongo fac
into Elastic Search.
I expect it to be able to find mongo factory
or mongodb something
equally, however, it does not.
Assume I have a single field called title
. I have three documents with the title
s:
I have a single boolean
should
clause with:
array('prefix' => array(
'title' => 'mongo fac'
)),
Using default analyzers, no special configuration, mongo factory
will be found but not mongodb something
.
What I want is for monogdb something
to appear in the results as well, basically for Elastic Search to tokenize the keywords; as well as searching for mongo fac
it should also search for mongo
and fac
.
Except for tokenizing myself what else can I do to get elastic search to work the way I want to, perferrably using their tokenizer as a means to tokenize my keywords?
为了引用其他人遇到这个问题:我最终没有找到一个有效的解决方案,所以我只写了一个函数来标记我自己的单词并形成单独的前缀查询,它的工作原理与它应该一样。
链接地址: http://www.djcxy.com/p/60132.html上一篇: 动态添加字段到搜索结果