Roland Kofler
Roland Kofler

Reputation: 1342

How can I boost results based on a parameter in SOLR

Depending on a parameter (user type) I need a different result order. For example: if a user is a baker and he types "f" in the searchfield he will get an auto-suggestion with boosted "flour". If the user is a butcher he gets boosted "flesh".

Upvotes: 0

Views: 133

Answers (1)

Jayendra
Jayendra

Reputation: 52809

If you want to boost your results according to the user type, you can have the user associated with each of the food item.

flesh document having user type field with butcher
flour document having user type field with baker

and you can boost the results with the query having additional boost on user type as -

q=user_type:butcher^2 f

This should find all the terms with f (given you are handling the autocomplete on some field) and boost the results for the user_type butcher, which should push all the food types associated with butcher to the top.

Upvotes: 1

Related Questions