xarion
xarion

Reputation: 470

Solr Queries do not return expected values

We have a solr configuration simply like this https://gist.github.com/118d17e93267123f4870

According to that, I'm indexing a title The Secret of Rhonda Byrne or the Law of Attraction in the Bible with an id.

Then I go to the Solr Analysis tool to see how its gonna get indexed in this field. So the index analysis if that field type with given value is returning something like;

secret rhonda byrne law attraction bible

Just to make sure, I'm querying the id field of that title to see if its there. Positive.

But when I query this index with the analysis tool result I get no results. My query is like;

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

As given in comments, debug output of that query is here; https://gist.github.com/9b88fd6b5f043c90d539

Upvotes: 1

Views: 404

Answers (1)

Jayendra
Jayendra

Reputation: 52779

Issue is with : -

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

The enablePositionIncrements with increment the positions whenever it encounters the stopwords. Hence, when you do an exact phrase match this would not match as position of the indexed title are not next to each other.

Read more of it here.

You should disable the position increments to able to be do a phrase match.

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

Upvotes: 2

Related Questions