2012-09-13 141 views
1

我们有一个Solr的配置只是这样https://gist.github.com/118d17e93267123f4870Solr的查询不返回预期值

根据这个,我索引标题朗达·伯恩在圣经与秘密或吸引力定律ID。

然后,我去Solr分析工具,看看它将如何得到这个领域的索引。因此,如果具有给定值的字段类型返回类似的索引分析;

secret rhonda byrne law attraction bible 

只是为了确认,我在查询该标题的id字段以查看它是否存在。正。

但是,当我用分析工具的结果查询这个指数,我没有得到任何结果。我的查询就像;

select?qf=title_stm&q="Secret+Rhonda+Byrne+Law+Attraction+Bible"&fl=id,title&defType=dismax 

正如在注释中给出的,该查询的调试输出在这里; https://gist.github.com/9b88fd6b5f043c90d539

+0

你怎么调试查询看起来像?您可以在生成的查询的url中添加debugQuery = on。 – Jayendra

+0

它在这里。 https://gist.github.com/9b88fd6b5f043c90d539 – xarion

回答

2

问题是: -

<filter class="solr.StopFilterFactory" 
     ignoreCase="true" 
     words="stopwords.txt" 
     enablePositionIncrements="true" 
     /> 

与增量的位置时,它遇到停用词的enablePositionIncrements。 因此,当你做一个精确的词组匹配时,这将不匹配,因为索引标题的位置并不相邻。

查看更多关于here

您应该禁用位置增量,以便能够进行词组匹配。

<filter class="solr.StopFilterFactory" 
     ignoreCase="true" 
     words="stopwords.txt" 
     enablePositionIncrements="false" 
     /> 
+0

非常有意义。会尽快尝试.. – xarion

+0

非常感谢。有用! – xarion