ElasticSearch:非分析字段中出现更多术语的得分越高?

时间:2013-09-18 01:21:56

标签: lucene elasticsearch

这是我在过去一周左右的时间里一直困扰着我的问题。我以为我把它钉了下来,但显然没有。

我的文档中有一个字段“tags”,目前是一个非分析字段。当我在这个字段上查询时,我希望带有MORE tags = query的文档返回更高的分数。

示例:假设我在标签字段中查询“ruby”

Document 1) tags: ["ruby", "ruby", "ruby"]
should score higher than:
Document 2) tags: ["ruby"]
and 
Document 3) tags: ["ruby", "python"]

我尝试将我的代码字段编入索引,如下所示。但他们都没有实现我想要的。在所有这些情况下,文档1从未得分最高。

:tags => {:type => 'string', :index => 'not_analyzed', :include_in_all => false, :omit_norms => true}
:tags => {:type => 'string', :index => 'analyzed', :analyzer => keyword, :include_in_all => false, :omit_norms => true}

0 个答案:

没有答案