奇怪的行为:有些词会破坏搜索Elasticsearch

时间:2016-12-06 23:59:56

标签: django elasticsearch elasticsearch-dsl

我正在使用http://elasticsearch-dsl.readthedocs.io 0.0.10和ES 1.7.3。

我在搜索过程中遇到了一些奇怪的行为:我传到的一些词语"应该"查询中断搜索,然后搜索找不到那些单词(我在控制台中看到),还有很多其他单词。

在下面的代码中,"应该"查询由1000个子句组成。我的猜测是这个词不是词汇量(我使用俄语和英语形态配置) - 但不,与其他看不见的特殊词语搜索是好的。 所以,当我删除这些"问题"单词搜索再次起作用。

这是非常奇怪的 - 我测试过"问题" https://django-haystack.readthedocs.io/en/v2.5.0/index.html和ES的单词可以找到它们....

for i in eat_search_raw_list_1024:
    q = Q('bool',
        #must=[Q('match', text='BBQ')],
        should=[(Q("match", text="\'bad service\'~3") | Q("match", text="\'bad eat\'~3")  .........1000 more................],
        minimum_should_match=1, 
        _name=name_query 
    )            
    s = Search(using=client, index="haystack").query(q).query(~Q("match", text=minus_words))    
    s = s.highlight('text', fragment_size=50)  
    response = s.execute()

0 个答案:

没有答案