Patrick Allaert
Patrick Allaert

Reputation: 1762

Solr: How to avoid the score to be diluted by multiple values?

My collection contain products that have a multivalued tags field.

  1. One product (P1) may have the tag: "Shoes".
  2. Another one (P2) may have the tags: "Shoes", "Sport", "Tennis".

Those products will be boosted by functions taking into account popularity. However, the base score, looking for "Shoes" only, would be: 1.5774288 for P1 and 1.3096721 for P2.

Would it be possible that the score be identical for both products?

It is as if the presence of many tags "dilutes" the relevance, for products having more tags than just "Shoes". This will interfere with the boost functions.

Upvotes: 3

Views: 68

Answers (2)

Patrick Allaert
Patrick Allaert

Reputation: 1762

As suggested by MatsLindh in a comment, setting omitNorms="true" on the field AND reindexing the collection made it possible to have equal scores.

Upvotes: 1

Simulant
Simulant

Reputation: 20142

you could use a filter query fq=Shoes instead of the query parameter q= to filter for the matching documents without affecting the score. A second query parameter to score the results would still be useful, as you can combine both.

The fq parameter defines a query that can be used to restrict the superset of documents that can be returned, without influencing score.

Upvotes: 1

Related Questions