Solrj Query - Get the most relevant record first

前端 未结 2 2025
清酒与你
清酒与你 2021-01-06 22:48

I have some documents in Solr 4.0. I want the most relevant records to be displayed first and then the less relevant ones.

For eg, I have 3 documents wi

相关标签:
2条回答
  • 2021-01-06 23:07

    I tried with "" around the query string and it worked.

    Like - q=title:"Income Distribution Policy" OR title:Income Distribution Policy.

    This gave me the output as document 1 then document 3 and then document 2. Not perfect but close enough.

    0 讨论(0)
  • 2021-01-06 23:18

    If you don't sort by anything else, you are sorting by Similarity/Relevance. So, if you are not getting the results in the right order, you may need to play with how you are assigning weights and which query parsers you are using.

    I assume you are using eDismax with the boost on the title field. In addition have a look at mm (minimum match) and pf (phrase fields) for boosting.

    You may also want to test with autoGeneratePhraseQueries field set on your fieldType.

    And, of course, debugQuery=true on the queries will help you to see what is going on. You may find that also adding debug.explain.structured=true could useful the first couple of times you are trying to read the debug output.

    0 讨论(0)
提交回复
热议问题