"Just some Word 13 from year 2011" -> "Just some Word 13 from..." /> "Just some Word 13 from year 2011" -> "Just some Word 13 from..." /> "Just some Word 13 from year 2011" -> "Just some Word 13 from..."/>

Solr result has not expected order

67 views Asked by At

I have several documents, that have a title:

  1. -> "Just some Word 13 from year 2015"
  2. -> "Just some Word 13 from year 2011"
  3. -> "Just some Word 13 from year 2012"
  4. -> "Just some Word 13 from year 2014"
  5. -> "Just some Word 13 from year 2013"

When searching for 13 i'm expecting number 5 to be the first result because 13 is exists twice.

Field is multiValued="true".

My fieldtype for indexing looks like this:

<analyzer type="index">
   <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="[(&quot;)(,:;!?)]" replacement=""/>
   <tokenizer class="solr.WhitespaceTokenizerFactory"/>
   <filter class="solr.LowerCaseFilterFactory"/>
   <filter class="solr.ReverseStringFilterFactory"/>
   <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="30" side="front"/>
   <filter class="solr.ReverseStringFilterFactory"/>
</analyzer>
2

There are 2 answers

0
assid On BEST ANSWER

solr copyfield directive (indexing with and without EdgeNGramFilterFactory) was the solution to boost direct hits.

1
Bruno dos Santos On

It's happening because the document 5 doesn't really have twice 13 term. What you have is 13 and 2013 that is so different for search. In this case all the five documents have just one 13 term, so the order is not wrong. If you want solr consider 13 and 2013 the same term you can use synonyms. So put this line in your synonyms.txt file:

13, 2013

And include this filter in your schema.xml file:

<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>

Now when you search for 13 the document 5 will have more relevancy than the others.