You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Puneet Pawaia <pu...@gmail.com> on 2013/12/25 19:29:57 UTC

Boosting results on value of field different from query

Hi all
I am using Solr 4.6. I want to query a field for a value but boost the
results based on a different value of another field.
Example search for car rental in products category field but boost results
for car types field with value compact by factor of 10 and sedan by factor
of 5.
I am using the Lucene Standard parser. I added {!edismax bq=type:compact^5
OR type:sedan^10} but that doesn't work.
Regards
Puneet

Re: Boosting results on value of field different from query

Posted by Kydryavtsev Andrey <we...@yandex.ru>.
Hi, Puneet

I think you can try of provided advice from there : http://wiki.apache.org/solr/SolrRelevancyFAQ 

Like this one  : http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_increase_the_score_for_specific_documents : set index time boos "per document", so set big boos for documents with type:compact and type:sedan

Or this one http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_change_the_score_of_a_document_based_on_the_.2Avalue.2A_of_a_field_.28say.2C_.22popularity.22.29 and  http://wiki.apache.org/solr/ExtendedDisMax#bf_.28Boost_Function.2C_additive.29   : use query time function for boosting, you can implement your own function query, called for example "typeBoosting", which will convert "type" value per document from string into boost number and use it like "typeBoosting(type)".

26.12.2013, 06:28, "Puneet Pawaia" <pu...@gmail.com>:
> Hi Manju
> Would this query not be searching for and thus restricting results to type
> sedan and compact?
> I would like the results to include other types but only show up lower down
> the list.
> Regards
> Puneet
> On 26 Dec 2013 07:15, "manju16832003" <ma...@gmail.com> wrote:
>
>>  Hi Puneet,
>>  if you type field is pre-determined text field ex type [compact, sedan,
>>  hatchback], I think you have to boost with query type field (q) to
>>  get more accurate boosting.
>>
>>  Ex: http://localhost:8983/solr/my/select?q=type:sedan^100 type:compact^10
>>
>>  (:*)^1&wt=json&indent=true&fl=,score&debug=results&bf=recip(rord(publish_date),1,2,3)^1.5&sort=score
>>  desc
>>
>>  For publish_date, replace with the date you use for getting latest
>>  resultes.
>>
>>  In the above query, things to note is that
>>   - fl=,score -> The result set would display score value for each document
>>   - sort by score as first sort field that will give you the documents with
>>  the highest boost value (score) on top
>>
>>   Play around with the boosting values ^100 ^10 (perhaps 5,10,20 ) and
>>  observe how the score value will change the documents.
>>
>>   I'm not really sure how solr calculation works, however the above query
>>  must give you the accurate boosted documents.
>>
>>  --
>>  View this message in context:
>>  http://lucene.472066.n3.nabble.com/Boosting-results-on-value-of-field-different-from-query-tp4108180p4108190.html
>>  Sent from the Solr - User mailing list archive at Nabble.com.

Re: Boosting results on value of field different from query

Posted by manju16832003 <ma...@gmail.com>.
Hi Puneet,

 http://localhost:8983/solr/my/select?q=type:sedan^100 type:compact^10
(:*)^1&wt=json&indent=true&fl=,score&debug=results&bf=recip(rord(publish_date),1,2,3)^1.5&sort=score 
> desc 

Not really. The query I mentioned it does not restrict the other types,
instead it would push other types to bottom of the list as they have lower
score. The query I mentioned, Cars with type sedan listed first, compact
secondly and rest are the bottom of the list.

You would have to control the logic at the application level, which type you
want to be on the top.
In the above query, we are boosting type sedan to be on top, compact below
the sedan types and rest are at the bottom.
Change the those boosting values to get the different results.



--
View this message in context: http://lucene.472066.n3.nabble.com/Boosting-results-on-value-of-field-different-from-query-tp4108180p4108636.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Boosting results on value of field different from query

Posted by Puneet Pawaia <pu...@gmail.com>.
Hi Manju
Would this query not be searching for and thus restricting results to type
sedan and compact?
I would like the results to include other types but only show up lower down
the list.
Regards
Puneet
On 26 Dec 2013 07:15, "manju16832003" <ma...@gmail.com> wrote:

> Hi Puneet,
> if you type field is pre-determined text field ex type [compact, sedan,
> hatchback], I think you have to boost with query type field (q) to
> get more accurate boosting.
>
> Ex: http://localhost:8983/solr/my/select?q=type:sedan^100 type:compact^10
>
> (:*)^1&wt=json&indent=true&fl=,score&debug=results&bf=recip(rord(publish_date),1,2,3)^1.5&sort=score
> desc
>
> For publish_date, replace with the date you use for getting latest
> resultes.
>
> In the above query, things to note is that
>  - fl=,score -> The result set would display score value for each document
>  - sort by score as first sort field that will give you the documents with
> the highest boost value (score) on top
>
>  Play around with the boosting values ^100 ^10 (perhaps 5,10,20 ) and
> observe how the score value will change the documents.
>
>  I'm not really sure how solr calculation works, however the above query
> must give you the accurate boosted documents.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Boosting-results-on-value-of-field-different-from-query-tp4108180p4108190.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Boosting results on value of field different from query

Posted by manju16832003 <ma...@gmail.com>.
Hi Puneet,
if you type field is pre-determined text field ex type [compact, sedan,
hatchback], I think you have to boost with query type field (q) to 
get more accurate boosting.

Ex: http://localhost:8983/solr/my/select?q=type:sedan^100 type:compact^10
(:*)^1&wt=json&indent=true&fl=,score&debug=results&bf=recip(rord(publish_date),1,2,3)^1.5&sort=score
desc

For publish_date, replace with the date you use for getting latest resultes.

In the above query, things to note is that 
 - fl=,score -> The result set would display score value for each document
 - sort by score as first sort field that will give you the documents with
the highest boost value (score) on top
 
 Play around with the boosting values ^100 ^10 (perhaps 5,10,20 ) and
observe how the score value will change the documents.
 
 I'm not really sure how solr calculation works, however the above query
must give you the accurate boosted documents.



--
View this message in context: http://lucene.472066.n3.nabble.com/Boosting-results-on-value-of-field-different-from-query-tp4108180p4108190.html
Sent from the Solr - User mailing list archive at Nabble.com.