3
votes

For Solr 5.0.0, is there any way to sort the results by their phrase slop.

Example: if my search word is laptop table, my current results are like this:

  • laptop dell inspiron table
  • dell laptop table
  • laptop sony table
  • dell inspiron laptop table

But it shoud be like:

  • dell laptop table
  • dell inspiron laptop table
  • laptop sony table
  • laptop dell inspiron table

It should give first results having the exact search word as it is, then results containing one word in between search words, then two and so on. Is it possible in Solr?

1

1 Answers

1
votes

Sure, use an actual phrase query with slop. Like:

"laptop table"~5

If your query is just laptop table, that's not queried as a phrase at all, so their proximity to each other within the document has no bearing whatsoever on the search.