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 manju16832003 <ma...@gmail.com> on 2014/05/22 06:04:44 UTC
Applying boosting for keyword search
HI,
I have a scenario where by I apply boosting in the following two cases
- Usual search, by user selection
- Keyword search. I have a field *keyword* that is copy/combination of many
fields
When user does the usual query, my boosting works fines, this is how I do
boosting
/select?q=featured:true^100&fq=make:toyota&sort=price asc
This works fine
However I'm confused, how we could perform boosting using *keyword* serach
/select?q=toyota&defType=edismax&bq=featured:true^100&sort=price asc
This does not work as I expected. In solrconfig.xml my default field set to
keyword (df=keyword)
My question, how could I perform boosting with keyword search?
when we are using keyword search, user keys goes into *q* param, so where
Can I specify the boosting query?
I tried with *bq* and *function query*, No luck :-(.
Can I perform like this
/select?q=toyota featured:true^100
Keyword and boosting done with *q* param.
--
View this message in context: http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by manju16832003 <ma...@gmail.com>.
Hi Jack,
Thank you for the suggestions. :-)
--
View this message in context: http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4138239.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by Erick Erickson <er...@gmail.com>.
The issue is absolute ordering (sort) and influencing (boosting).
Here's an example....
score
no boosts popularity
doc1 100 1
doc2 75 2
doc3 10 3
Sorting by popularity asc will return doc1, doc2, doc3
Sorting by popularity desc will return doc3, doc2, doc1
It doesn't matter at all what the score is. When sorting by popularity
ascending will sort in this order if the score of doc3 is 10,000 and
the score of doc1 is 100. sorting totally overrides ranking.
Boosting, on the other hand, only changes order if you sort by score
(which is the default, "ranking"). So sorting by score desc would
return doc1, doc2, doc3.
Now, say you boost the docs such that you add 50 to the score for
doc2. The returned order would be doc2, doc1, doc3.
The deal here is that boosting changes the _score_, but doesn't impose
an absolute ordering. Sorting by the value in a field imposes an
absolute, unchanging ordering.
Best,
Erick
On Tue, May 27, 2014 at 12:30 AM, manju16832003 <ma...@gmail.com> wrote:
> Hi Erick,
>
> Your explanation leads me to one question :-)
>
> if
> */select?q=featured:true^100&fq=make:toyota&sort=featured_date desc,price
> asc*
>
> The above query, without edismax, works well because, If I'm not mistaken
> its boosting document by value method.
>
> So I'm boosting all my documents with the value featured=true and all those
> documents would be sorted by their featured date in descending order (Latest
> featured documents) and price (lower to higher).
>
> My question is,
> If we were to boost the documents based on a value, how could we make sure
> the order of the documents?
>
> For example :
> https://wiki.apache.org/solr/SolrRelevancyFAQ
> defType=dismax&qf=text&q=supervillians&bf=popularity
>
> In the above case, all the documents that contains the word *popularity*
> would be on top depends on their score.
>
> However, I want to order the documents by certain criteria that contains the
> word popularity.... So we would have to use *sort* to order the documents.
>
> if we say, boosting has no or almost no effect if we use sort, then whats
> the contradiction story between *sort* and *boost*
>
> :-) would be interesting to know the answer
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4138241.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by manju16832003 <ma...@gmail.com>.
Hi Erick,
Your explanation leads me to one question :-)
if
*/select?q=featured:true^100&fq=make:toyota&sort=featured_date desc,price
asc*
The above query, without edismax, works well because, If I'm not mistaken
its boosting document by value method.
So I'm boosting all my documents with the value featured=true and all those
documents would be sorted by their featured date in descending order (Latest
featured documents) and price (lower to higher).
My question is,
If we were to boost the documents based on a value, how could we make sure
the order of the documents?
For example :
https://wiki.apache.org/solr/SolrRelevancyFAQ
defType=dismax&qf=text&q=supervillians&bf=popularity
In the above case, all the documents that contains the word *popularity*
would be on top depends on their score.
However, I want to order the documents by certain criteria that contains the
word popularity.... So we would have to use *sort* to order the documents.
if we say, boosting has no or almost no effect if we use sort, then whats
the contradiction story between *sort* and *boost*
:-) would be interesting to know the answer
--
View this message in context: http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4138241.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by Erick Erickson <er...@gmail.com>.
Your boosting in these examples is almost, but not quite totally,
useless. Here's why:
&sort=price asc
The only time the score of the doc (which is what boosting influences)
will be used for ordering the output is as a tie-breaker when the
price is _exactly_ the same.
FWIW,
Erick
On Wed, May 21, 2014 at 9:53 PM, Jack Krupansky <ja...@basetechnology.com> wrote:
> Your original message had "q=toyota featured:true^100" and also using bq -
> both are valid. If either is not working for you, please be specific about
> what exactly is not behaving as you expected - what the symptom is.
> Sometimes you have to experiment with the boost factor.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: manju16832003
> Sent: Thursday, May 22, 2014 12:37 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Applying boosting for keyword search
>
>
> Hi Jack,
> Thanks for your help.
>
> I do not want to boost *keyword* field. I apply full text search no keyword
> field and boost based on another field *featured*.
>
> Also qf field allows us to boost the field without values. I would like to
> boost with value
>
> Ex: qf=featured:true^100 - I don't think this is correct
>
> Example : Get all Toyota 2013 Car listings, which are featured listings.
> Field *featured* is a boolean flag
>
> So I tried this way
>
> /select?q=toyota
> 2014&defType=edismax&q.op=AND&qf=featured:true^100&wt=json&sort=price asc
>
> No luck :-(.
>
> My boosting works fine without keyword, I only have issue having keyword
> search.
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4137528.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by Jack Krupansky <ja...@basetechnology.com>.
Your original message had "q=toyota featured:true^100" and also using bq -
both are valid. If either is not working for you, please be specific about
what exactly is not behaving as you expected - what the symptom is.
Sometimes you have to experiment with the boost factor.
-- Jack Krupansky
-----Original Message-----
From: manju16832003
Sent: Thursday, May 22, 2014 12:37 AM
To: solr-user@lucene.apache.org
Subject: Re: Applying boosting for keyword search
Hi Jack,
Thanks for your help.
I do not want to boost *keyword* field. I apply full text search no keyword
field and boost based on another field *featured*.
Also qf field allows us to boost the field without values. I would like to
boost with value
Ex: qf=featured:true^100 - I don't think this is correct
Example : Get all Toyota 2013 Car listings, which are featured listings.
Field *featured* is a boolean flag
So I tried this way
/select?q=toyota
2014&defType=edismax&q.op=AND&qf=featured:true^100&wt=json&sort=price asc
No luck :-(.
My boosting works fine without keyword, I only have issue having keyword
search.
--
View this message in context:
http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4137528.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by manju16832003 <ma...@gmail.com>.
Hi Jack,
Thanks for your help.
I do not want to boost *keyword* field. I apply full text search no keyword
field and boost based on another field *featured*.
Also qf field allows us to boost the field without values. I would like to
boost with value
Ex: qf=featured:true^100 - I don't think this is correct
Example : Get all Toyota 2013 Car listings, which are featured listings.
Field *featured* is a boolean flag
So I tried this way
/select?q=toyota
2014&defType=edismax&q.op=AND&qf=featured:true^100&wt=json&sort=price asc
No luck :-(.
My boosting works fine without keyword, I only have issue having keyword
search.
--
View this message in context: http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523p4137528.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Applying boosting for keyword search
Posted by Jack Krupansky <ja...@basetechnology.com>.
Just add the boost to the keyword: q=toyota^100.
Or, use the dismax or edismax query parsers and then the boost can be
specified for the field: qf=keyword^100.
-- Jack Krupansky
-----Original Message-----
From: manju16832003
Sent: Thursday, May 22, 2014 12:04 AM
To: solr-user@lucene.apache.org
Subject: Applying boosting for keyword search
HI,
I have a scenario where by I apply boosting in the following two cases
- Usual search, by user selection
- Keyword search. I have a field *keyword* that is copy/combination of many
fields
When user does the usual query, my boosting works fines, this is how I do
boosting
/select?q=featured:true^100&fq=make:toyota&sort=price asc
This works fine
However I'm confused, how we could perform boosting using *keyword* serach
/select?q=toyota&defType=edismax&bq=featured:true^100&sort=price asc
This does not work as I expected. In solrconfig.xml my default field set to
keyword (df=keyword)
My question, how could I perform boosting with keyword search?
when we are using keyword search, user keys goes into *q* param, so where
Can I specify the boosting query?
I tried with *bq* and *function query*, No luck :-(.
Can I perform like this
/select?q=toyota featured:true^100
Keyword and boosting done with *q* param.
--
View this message in context:
http://lucene.472066.n3.nabble.com/Applying-boosting-for-keyword-search-tp4137523.html
Sent from the Solr - User mailing list archive at Nabble.com.