Krishnachandra Sharma
Krishnachandra Sharma

Reputation: 1342

How to specify searching sequence in fields in solr?

I am a newbie for Solr.

I have few fields.

  1. Title
  2. Abstract
  3. Desc

I want solr to first check if it matches the Title, then in Abstract and finally in Desc.

I Googled and found suggestions to boost factors in qf field. But with this I don't see the result what I wish for.

How do I achieve this?

Upvotes: 0

Views: 260

Answers (1)

femtoRgon
femtoRgon

Reputation: 33341

If you just want to match in title, and only search in abstract if you find nothing, I would just run separate searches. Search for titles, if you find nothing, move on to the next query.

If you want to get matches to all three fields at once, with Title matches at the top, boosting is the right way to go, and the qf parameter is the probably the easiest approach. Perhaps the problem is you aren't defining large enough boosts. There are a lot of statistics that influence score, boost being only one of them, so if you want your boost to dominate scoring behavior in this way, big differences count! Perhaps something like:

q=solr&defType=dismax&qf=title^1000.0+abstract^10.0+desc^0.1

Upvotes: 2

Related Questions