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 "Dean Missikowski (Consultant), CLSA" <de...@clsa.com> on 2009/03/08 05:00:35 UTC

Query Boosting using both BQ and BF

Hi,

 

I have a couple of questions related to query boosting using the dismax
request handler. I'm using a recent 1.4 build (to take advantage of
omitTf), and have also tried all of this with 1.3.

 

To apply a query-time boost to the previous 3 months of documents in my
index I use:

<str name="bq">published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
</str>

 

And, to provide a boosting that helps rank recently documents higher I
use:

<str name="bf">recip(rord(published_date_d),20,5000,5)^5.5</str>

 

This seems to be working well.

 

But I have more boosting requirements.  For example, I need to boost
documents that are tagged as printed. So, I tried to add another bq
parameter:

<str name="bq">is_printed_b:true^4.0</str>

 

Also, tried to append this space-separated all in one bq parameter like
this:

<str name="bq">published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
is_printed_b:true^4.0</str> 

 

Lastly, I need to apply a negative boost to documents of a certain type,
so I use:

<str name="bq">-is_mp_parent_b:true^50.0</str>

 

Not sure if it matters, but I have <solrQueryParser
defaultOperator="AND"/> in schema.xml 

 

None of those variations return expected results (it's like the bq is
being applied as a filter instead of just applying boosts).

 

Q1. Can anyone confirm whether bf and bq can both be used together in
solrconfig.xml?

Q2. Is there a way I can do ths using only BF? How? 

Q2. Can I have multiple bq parameters? If so, do I space-separate them
as a single bq, or provide multiple BQs?

Q3. Am I formulating my BQs that use Boolean fields correctly?

 

Any help or insights much appreciated,

Thanks Dean

 


CLSA CLEAN & GREEN: Please consider our environment before printing this email.
The content of this communication is subject to CLSA Legal and Regulatory Notices. 
These can be viewed at https://www.clsa.com/disclaimer.html or sent to you upon request.



RE: Query Boosting using both BQ and BF

Posted by "Dean Missikowski (Consultant), CLSA" <de...@clsa.com>.
I found similar results when trying to use negative boost with values < 1. Chris mentioned in this thread http://markmail.org/message/d2dc4oocrynx7wj2 a way to implement negative boost is to add positive boost to everything except the case you want to demote.
So, <str name="bq">-type:story^2.0</str>.

-----Original Message-----
From: Peter Wolanin [mailto:peter.wolanin@acquia.com] 
Sent: 10/03/2009 12:37 AM
To: solr-user@lucene.apache.org
Subject: Re: Query Boosting using both BQ and BF

This doesn't seem to match what I'm seeing in terms of using bq -
using any value > 0 increases the score.  For example, with no bq:

  <str name="q">solr</str>
  <str name="fl">title,score,type</str>
  <str name="version">2.2</str>
 </lst>
</lst>
<result name="response" numFound="35" start="0" maxScore="1.6885357">
 <doc>

  <float name="score">1.6885357</float>
  <str name="title">Building a killer search for Drupal</str>
  <str name="type">wikipage</str>
 </doc>
 <doc>
  <float name="score">1.5547959</float>
  <str name="title">New Solr module available for testing</str>

  <str name="type">story</str>
 </doc>
 <doc>
  <float name="score">1.408378</float>
  <str name="title">Check out the Solr project!</str>
  <str name="type">story</str>
 </doc>


Versus with a bq < 1, the scores of matching docs are still increased
compared to using no bq:

  <str name="bq">type:story^0.5</str>
  <str name="indent">on</str>
  <str name="q">solr</str>
  <str name="fl">title,score,type</str>
  <str name="version">2.2</str>
 </lst>

</lst>
<result name="response" numFound="35" start="0" maxScore="1.6885297">
 <doc>
  <float name="score">1.6885297</float>
  <str name="title">Building a killer search for Drupal</str>
  <str name="type">wikipage</str>
 </doc>
 <doc>
  <float name="score">1.5585454</float>
  <str name="title">New Solr module available for testing</str>
  <str name="type">story</str>
 </doc>
 <doc>
  <float name="score">1.4121282</float>
  <str name="title">Check out the Solr project!</str>
  <str name="type">story</str>
 </doc>



On Sun, Mar 8, 2009 at 9:48 AM, Otis Gospodnetic
<ot...@yahoo.com> wrote:
>
> Also note that the following is not doing what you want:
>
> <str name="bq">-is_mp_parent_b:true^50.0</str>
>
> You want something like:
>
> <str name="bq">is_mp_parent_b:true^0.20</str>
>
> for negative boosting use a boost that is less than 1.0.
>
> Otis--
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
>
> ----- Original Message ----
>> From: "Dean Missikowski (Consultant), CLSA" <de...@clsa.com>
>> To: solr-user@lucene.apache.org
>> Sent: Sunday, March 8, 2009 3:30:28 AM
>> Subject: RE: Query Boosting using both BQ and BF
>>
>> Some more experiments have helped me answer my own questions.
>>
>> > Q1. Can anyone confirm whether bf and bq can both
>> > be used together in solrconfig.xml?
>> yes
>>
>> > Q3. Can I have multiple bq parameters? If so, do I
>> > space-separate them as a single bq, or provide
>> > multiple BQs?
>> Yes, multiple bq parameters work, space-separating multiple query terms
>> in a single bq also works.
>>
>> Here's a snippet of my solrconfig.xml:
>>
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^5.2 OR
>> (published_date_d:[NOW-12MONTHS/DAY TO NOW/DAY+1DAY] AND
>> report_type_id_i:10000004)^10.0 OR (published_date_d:[NOW-6MONTHS/DAY TO
>> NOW/DAY+1DAY] AND is_printed_b:true)^4.0
>> is_mp_parent_b:false^10.0
>> recip(rord(published_date_d),20,5000,5)^5.5
>>
>>
>> -----Original Message-----
>> From: Dean Missikowski (Consultant), CLSA
>> Sent: 08/03/2009 12:01 PM
>> To: solr-user@lucene.apache.org
>> Subject: Query Boosting using both BQ and BF
>>
>> Hi,
>>
>> I have a couple of questions related to query boosting using the dismax
>> request handler. I'm using a recent 1.4 build (to take advantage of
>> omitTf), and have also tried all of this with 1.3.
>>
>> To apply a query-time boost to the previous 3 months of documents in my
>> index I use:
>>
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
>>
>>
>> And, to provide a boosting that helps rank recently documents higher I
>> use:
>> recip(rord(published_date_d),20,5000,5)^5.5
>>
>> This seems to be working well.
>>
>> But I have more boosting requirements.  For example, I need to boost
>> documents that are tagged as printed. So, I tried to add another bq
>> parameter:
>>
>> is_printed_b:true^4.0
>>
>> Also, tried to append this space-separated all in one bq parameter like
>> this:
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
>> is_printed_b:true^4.0
>>
>> Lastly, I need to apply a negative boost to documents of a certain type,
>> so I use:
>> -is_mp_parent_b:true^50.0
>>
>> Not sure if it matters, but I have
>> defaultOperator="AND"/> in schema.xml
>>
>> None of those variations return expected results (it's like the bq is
>> being applied as a filter instead of just applying boosts).
>>
>> Q1. Can anyone confirm whether bf and bq can both be used together in
>> solrconfig.xml?
>> Q2. Is there a way I can do ths using only BF? How?
>> Q3. Can I have multiple bq parameters? If so, do I space-separate them
>> as a single bq, or provide multiple BQs?
>> Q3. Am I formulating my BQs that use Boolean fields correctly?
>>
>> Any help or insights much appreciated,
>>
>> Thanks Dean
>>
>> CLSA CLEAN & GREEN: Please consider our environment before printing this email.
>> The content of this communication is subject to CLSA Legal and Regulatory
>> Notices.
>> These can be viewed at https://www.clsa.com/disclaimer.html or sent to you upon
>> request.
>
>



-- 
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com

Re: Query Boosting using both BQ and BF

Posted by Peter Wolanin <pe...@acquia.com>.
This doesn't seem to match what I'm seeing in terms of using bq -
using any value > 0 increases the score.  For example, with no bq:

  <str name="q">solr</str>
  <str name="fl">title,score,type</str>
  <str name="version">2.2</str>
 </lst>
</lst>
<result name="response" numFound="35" start="0" maxScore="1.6885357">
 <doc>

  <float name="score">1.6885357</float>
  <str name="title">Building a killer search for Drupal</str>
  <str name="type">wikipage</str>
 </doc>
 <doc>
  <float name="score">1.5547959</float>
  <str name="title">New Solr module available for testing</str>

  <str name="type">story</str>
 </doc>
 <doc>
  <float name="score">1.408378</float>
  <str name="title">Check out the Solr project!</str>
  <str name="type">story</str>
 </doc>


Versus with a bq < 1, the scores of matching docs are still increased
compared to using no bq:

  <str name="bq">type:story^0.5</str>
  <str name="indent">on</str>
  <str name="q">solr</str>
  <str name="fl">title,score,type</str>
  <str name="version">2.2</str>
 </lst>

</lst>
<result name="response" numFound="35" start="0" maxScore="1.6885297">
 <doc>
  <float name="score">1.6885297</float>
  <str name="title">Building a killer search for Drupal</str>
  <str name="type">wikipage</str>
 </doc>
 <doc>
  <float name="score">1.5585454</float>
  <str name="title">New Solr module available for testing</str>
  <str name="type">story</str>
 </doc>
 <doc>
  <float name="score">1.4121282</float>
  <str name="title">Check out the Solr project!</str>
  <str name="type">story</str>
 </doc>



On Sun, Mar 8, 2009 at 9:48 AM, Otis Gospodnetic
<ot...@yahoo.com> wrote:
>
> Also note that the following is not doing what you want:
>
> <str name="bq">-is_mp_parent_b:true^50.0</str>
>
> You want something like:
>
> <str name="bq">is_mp_parent_b:true^0.20</str>
>
> for negative boosting use a boost that is less than 1.0.
>
> Otis--
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
>
> ----- Original Message ----
>> From: "Dean Missikowski (Consultant), CLSA" <de...@clsa.com>
>> To: solr-user@lucene.apache.org
>> Sent: Sunday, March 8, 2009 3:30:28 AM
>> Subject: RE: Query Boosting using both BQ and BF
>>
>> Some more experiments have helped me answer my own questions.
>>
>> > Q1. Can anyone confirm whether bf and bq can both
>> > be used together in solrconfig.xml?
>> yes
>>
>> > Q3. Can I have multiple bq parameters? If so, do I
>> > space-separate them as a single bq, or provide
>> > multiple BQs?
>> Yes, multiple bq parameters work, space-separating multiple query terms
>> in a single bq also works.
>>
>> Here's a snippet of my solrconfig.xml:
>>
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^5.2 OR
>> (published_date_d:[NOW-12MONTHS/DAY TO NOW/DAY+1DAY] AND
>> report_type_id_i:10000004)^10.0 OR (published_date_d:[NOW-6MONTHS/DAY TO
>> NOW/DAY+1DAY] AND is_printed_b:true)^4.0
>> is_mp_parent_b:false^10.0
>> recip(rord(published_date_d),20,5000,5)^5.5
>>
>>
>> -----Original Message-----
>> From: Dean Missikowski (Consultant), CLSA
>> Sent: 08/03/2009 12:01 PM
>> To: solr-user@lucene.apache.org
>> Subject: Query Boosting using both BQ and BF
>>
>> Hi,
>>
>> I have a couple of questions related to query boosting using the dismax
>> request handler. I'm using a recent 1.4 build (to take advantage of
>> omitTf), and have also tried all of this with 1.3.
>>
>> To apply a query-time boost to the previous 3 months of documents in my
>> index I use:
>>
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
>>
>>
>> And, to provide a boosting that helps rank recently documents higher I
>> use:
>> recip(rord(published_date_d),20,5000,5)^5.5
>>
>> This seems to be working well.
>>
>> But I have more boosting requirements.  For example, I need to boost
>> documents that are tagged as printed. So, I tried to add another bq
>> parameter:
>>
>> is_printed_b:true^4.0
>>
>> Also, tried to append this space-separated all in one bq parameter like
>> this:
>> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
>> is_printed_b:true^4.0
>>
>> Lastly, I need to apply a negative boost to documents of a certain type,
>> so I use:
>> -is_mp_parent_b:true^50.0
>>
>> Not sure if it matters, but I have
>> defaultOperator="AND"/> in schema.xml
>>
>> None of those variations return expected results (it's like the bq is
>> being applied as a filter instead of just applying boosts).
>>
>> Q1. Can anyone confirm whether bf and bq can both be used together in
>> solrconfig.xml?
>> Q2. Is there a way I can do ths using only BF? How?
>> Q3. Can I have multiple bq parameters? If so, do I space-separate them
>> as a single bq, or provide multiple BQs?
>> Q3. Am I formulating my BQs that use Boolean fields correctly?
>>
>> Any help or insights much appreciated,
>>
>> Thanks Dean
>>
>> CLSA CLEAN & GREEN: Please consider our environment before printing this email.
>> The content of this communication is subject to CLSA Legal and Regulatory
>> Notices.
>> These can be viewed at https://www.clsa.com/disclaimer.html or sent to you upon
>> request.
>
>



-- 
Peter M. Wolanin, Ph.D.
Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com

Re: Query Boosting using both BQ and BF

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Also note that the following is not doing what you want:

<str name="bq">-is_mp_parent_b:true^50.0</str>

You want something like:

<str name="bq">is_mp_parent_b:true^0.20</str>
 
for negative boosting use a boost that is less than 1.0.

Otis--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: "Dean Missikowski (Consultant), CLSA" <de...@clsa.com>
> To: solr-user@lucene.apache.org
> Sent: Sunday, March 8, 2009 3:30:28 AM
> Subject: RE: Query Boosting using both BQ and BF 
> 
> Some more experiments have helped me answer my own questions.
> 
> > Q1. Can anyone confirm whether bf and bq can both 
> > be used together in solrconfig.xml?
> yes
> 
> > Q3. Can I have multiple bq parameters? If so, do I 
> > space-separate them as a single bq, or provide 
> > multiple BQs?
> Yes, multiple bq parameters work, space-separating multiple query terms
> in a single bq also works.
> 
> Here's a snippet of my solrconfig.xml:
> 
> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^5.2 OR
> (published_date_d:[NOW-12MONTHS/DAY TO NOW/DAY+1DAY] AND
> report_type_id_i:10000004)^10.0 OR (published_date_d:[NOW-6MONTHS/DAY TO
> NOW/DAY+1DAY] AND is_printed_b:true)^4.0
> is_mp_parent_b:false^10.0
> recip(rord(published_date_d),20,5000,5)^5.5
> 
> 
> -----Original Message-----
> From: Dean Missikowski (Consultant), CLSA 
> Sent: 08/03/2009 12:01 PM
> To: solr-user@lucene.apache.org
> Subject: Query Boosting using both BQ and BF 
> 
> Hi,
> 
> I have a couple of questions related to query boosting using the dismax
> request handler. I'm using a recent 1.4 build (to take advantage of
> omitTf), and have also tried all of this with 1.3.
> 
> To apply a query-time boost to the previous 3 months of documents in my
> index I use:
> 
> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
> 
> 
> And, to provide a boosting that helps rank recently documents higher I
> use:
> recip(rord(published_date_d),20,5000,5)^5.5
> 
> This seems to be working well.
> 
> But I have more boosting requirements.  For example, I need to boost
> documents that are tagged as printed. So, I tried to add another bq
> parameter:
> 
> is_printed_b:true^4.0
> 
> Also, tried to append this space-separated all in one bq parameter like
> this:
> published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
> is_printed_b:true^4.0 
> 
> Lastly, I need to apply a negative boost to documents of a certain type,
> so I use:
> -is_mp_parent_b:true^50.0
> 
> Not sure if it matters, but I have 
> defaultOperator="AND"/> in schema.xml 
> 
> None of those variations return expected results (it's like the bq is
> being applied as a filter instead of just applying boosts).
> 
> Q1. Can anyone confirm whether bf and bq can both be used together in
> solrconfig.xml?
> Q2. Is there a way I can do ths using only BF? How? 
> Q3. Can I have multiple bq parameters? If so, do I space-separate them
> as a single bq, or provide multiple BQs?
> Q3. Am I formulating my BQs that use Boolean fields correctly?
> 
> Any help or insights much appreciated,
> 
> Thanks Dean
> 
> CLSA CLEAN & GREEN: Please consider our environment before printing this email.
> The content of this communication is subject to CLSA Legal and Regulatory 
> Notices. 
> These can be viewed at https://www.clsa.com/disclaimer.html or sent to you upon 
> request.


RE: Query Boosting using both BQ and BF

Posted by "Dean Missikowski (Consultant), CLSA" <de...@clsa.com>.
Some more experiments have helped me answer my own questions.

> Q1. Can anyone confirm whether bf and bq can both 
> be used together in solrconfig.xml?
yes

> Q3. Can I have multiple bq parameters? If so, do I 
> space-separate them as a single bq, or provide 
> multiple BQs?
Yes, multiple bq parameters work, space-separating multiple query terms
in a single bq also works.

Here's a snippet of my solrconfig.xml:

<str name="bq">published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^5.2 OR
(published_date_d:[NOW-12MONTHS/DAY TO NOW/DAY+1DAY] AND
report_type_id_i:10000004)^10.0 OR (published_date_d:[NOW-6MONTHS/DAY TO
NOW/DAY+1DAY] AND is_printed_b:true)^4.0</str>
<str name="bq">is_mp_parent_b:false^10.0</str>
<str name="bf">recip(rord(published_date_d),20,5000,5)^5.5</str>


-----Original Message-----
From: Dean Missikowski (Consultant), CLSA 
Sent: 08/03/2009 12:01 PM
To: solr-user@lucene.apache.org
Subject: Query Boosting using both BQ and BF 

Hi,

I have a couple of questions related to query boosting using the dismax
request handler. I'm using a recent 1.4 build (to take advantage of
omitTf), and have also tried all of this with 1.3.

To apply a query-time boost to the previous 3 months of documents in my
index I use:

<str name="bq">published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
</str>

And, to provide a boosting that helps rank recently documents higher I
use:
<str name="bf">recip(rord(published_date_d),20,5000,5)^5.5</str>

This seems to be working well.

But I have more boosting requirements.  For example, I need to boost
documents that are tagged as printed. So, I tried to add another bq
parameter:

<str name="bq">is_printed_b:true^4.0</str>

Also, tried to append this space-separated all in one bq parameter like
this:
<str name="bq">published_date_d:[NOW-3MONTHS/DAY TO NOW/DAY+1DAY]^10.2
is_printed_b:true^4.0</str> 

Lastly, I need to apply a negative boost to documents of a certain type,
so I use:
<str name="bq">-is_mp_parent_b:true^50.0</str>

Not sure if it matters, but I have <solrQueryParser
defaultOperator="AND"/> in schema.xml 

None of those variations return expected results (it's like the bq is
being applied as a filter instead of just applying boosts).

Q1. Can anyone confirm whether bf and bq can both be used together in
solrconfig.xml?
Q2. Is there a way I can do ths using only BF? How? 
Q3. Can I have multiple bq parameters? If so, do I space-separate them
as a single bq, or provide multiple BQs?
Q3. Am I formulating my BQs that use Boolean fields correctly?

Any help or insights much appreciated,

Thanks Dean

CLSA CLEAN & GREEN: Please consider our environment before printing this email.
The content of this communication is subject to CLSA Legal and Regulatory Notices. 
These can be viewed at https://www.clsa.com/disclaimer.html or sent to you upon request.