2012-09-13 137 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