fiddlin-dev
fiddlin-dev

Reputation: 129

Solr Result Ranking modifications to a particlar query

I am newbie to Solr and I am trying to build a simple search solution for my website. I am trying to build a feature which is similar to Swifttype's result ranking feature. i.e., Lets say "ice" results in

  1. Ice
  2. Iceberg
  3. Ice cream
  4. ......

so on....

If i want to rank "Ice cream" higher only for query "ice", but when i search for other search terms like "Iceland" default ranking should be maintained. how can i achieve that?

I am using solr v7.5

Thanks in advance...

Upvotes: 1

Views: 28

Answers (1)

Mysterion
Mysterion

Reputation: 9320

The Query Elevation Component lets you configure the top results for a given query regardless of the normal Lucene scoring.

More importantly, you will need to configure elevate.xml file which looks like this:

<elevate>
  <query text="ice">
    <doc id="1" /> //where id=1 is your ice cream document
    <doc id="2" />
    <doc id="3" />
  </query>

</elevate>

Later, during searches you only need to enable it by specifying http param enableElevation=true

Upvotes: 2

Related Questions