0

I am having 4 fields in solr. For ex. Field1, Field2, Field3 and Field4.

My boost sequence is like field1^10, field2^8, field3^7 field4^6.

Now if I search for a keyword marketing lets say q=(Field1:("marketing")^10 OR Field2:("marketing")^8 OR Field3:("marketing")^7 OR Field4:("marketing")^6).

Requirement: Now according to requirement, marketing present in field1 should appear first and so on which is working fine.

Problem: But there is one record where marketing is appearing in Field3 and Field4 and it is appearing 2nd in result while record containing marketing in Field2 is appearing 3rd in result which is probably because of scoring mechanism.

Solution I need: I want to show records in the order of boost applied in that field no matter if it is found in multiple field i.e. the record having marketing in field2 should always appear 2nd in result.

GrafikRobot
  • 3,020
  • 1
  • 20
  • 21
  • You might need to change the strategy of boosting as all search terms are sum-ups in the end – Oyeme Mar 25 '19 at 11:46
  • @Oyeme sorry for the spelling mistake. this is only the boosting technique i can think off. Moreover, the search term will remain same for all the fields. Our client just needs ordering in above mentioned fields and in the scenario mentioned above. Please let me know in case you have any solutions to this. Thank you for the response. – lalit S. joshi Mar 25 '19 at 13:38
  • Be aware that the scores will be affected by more than just the boost (such as the number of occurences, etc.). You can however try to increase your boosts to have a much larger difference between the different levels - field1^100000, field2^10000, field3^1000 field4^100 - that way, given the same content, two later fields will not add up to a larger boost than the ones before it. – MatsLindh Mar 25 '19 at 18:59
  • @MatsLindh thank you so so much for the response. It worked for me very well. my issue is resolved. – lalit S. joshi Mar 26 '19 at 09:29

2 Answers2

1

Response given by @MatsLindh in the comments is the proper solution :

You can however try to increase your boosts to have a much larger difference between the different levels - field1^100000, field2^10000, field3^1000 field4^100 - that way, given the same content, two later fields will not add up to a larger boost than the ones before it.

Note: Be aware that the scores will be affected by more than just the boost (such as the number of occurences, etc.).

EricLavault
  • 12,130
  • 3
  • 23
  • 45
0

I can think on two way to solve this:

  1. Use qf query parameter - if you pass the fields and boots in the qf parameter instead of q so your query looks something like that: q=marketing&qf="field1^10 field2^8, field3^7 field4^6" then the parsed query will be something like: max(field1:marketing^10,field2:marketing^8,field3:marketing^7 OR , field4:marketing^6) so it doesn't matter in how many fields they appear it'll only take the max.

  2. Change the boosts so each boost value is higher than the sum of the boost before him. e.g: field4^1, field3^2, field2^4, field1^8, that way no combination of fields can affect the ordering.

Tomer Arazy
  • 1,833
  • 10
  • 15
  • Thank you for the response. But i think i won't be able to use qf parameter as we are using SiteCore Content Search Linq to query solr and as per my best knowledge i can only use q and fq but there is no option for qf. But I will appreciate you explanation and this enhances my knowledge regarding solr boosting. – lalit S. joshi Mar 26 '19 at 09:39
  • "*it will only take the max*" assumption.. false unless using a *dismax/edismax* query parser with a tie of 0. – EricLavault Apr 15 '19 at 09:55