0

I'm trying to get in different ways the SOLR documents scored and it's working almost fine: for example by title, description and type. To confirm this, I'm using the Debug Mode from SOLR, to get additional debugging information.

My wish would be, to get better scores for documents with certain category. For that, I'm using the function createFilterQuery from Solarium PHP...

$querySOLR->createFilterQuery( 'type' )->setQuery( 'type: ( type:job^1.0 type:article^0.8 type:forum^0.8 type:maga^0.7 type:semi^0.7 type:press^0.6 type:fair^0.3 type:book^0.3 type:poll^0.3 type:newsletter^0.2 )' );

In this example, all documents of type 'job' should have better Type-Scoring as documents of type 'article', but this is not the case...

Document 1

Title, Test 1
Description, Lorem ipsum 1
Type, article (Scoring, 2.5)

Document 2

Title, Test 2
Description, Lorem ipsum 2
Type, article (Scoring, 2.5)

Document 3

Title, Test 3
Description, Lorem ipsum 3
Type, job (Scoring, 1.5)

Document 4

Title, Test 4
Description, Lorem ipsum 4
Type, job (Scoring, 1.5)

... documents of type 'article' are getting better Type-Scoring as documents of type 'job'. I'm missing something? Or are the scores calculated in another way as I think?

A. M.
  • 1
  • Filter queries does not affect score. You're probably looking for the `boostquery` support of the (e)dismax queries: https://solarium.readthedocs.io/en/stable/queries/select-query/building-a-select-query/components/dismax-component/ – MatsLindh Jan 21 '21 at 09:25
  • Hello @MatsLindh, thank you very much for the reply! I have implemented your suggestion, but it doesn't work as expected: SOLR is adding an additional scoring, but it changes depending of the number of documents containing that category. My wish would be just to add a 'Fix Scoring Value' to certain categories, independently of the number of documents containing that category. Do you have maybe any idea how can I get this result? Thank you in advance! – A. M. Feb 05 '21 at 12:39
  • In that case you want `^=`, not `^` by itself: https://lucene.apache.org/solr/guide/8_6/the-standard-query-parser.html#constant-score-with – MatsLindh Feb 05 '21 at 12:48

0 Answers0