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 dinesh naik <di...@gmail.com> on 2015/09/07 15:51:23 UTC

Different boost values for multiple parsers in Solr 5.2.1

Hi all,

Is there a way to apply different boost , using bq parameter for different
parser.

for example if i am using a synonym parser and edismax parser in a single
query, my bq param value is getting applied for both the parser making the
boost value double.

-- 
Best Regards,
Dinesh Naik

Re: Different boost values for multiple parsers in Solr 5.2.1

Posted by dinesh naik <di...@gmail.com>.
Hi Upayavira,
We have an issue here.

The boosting work as expected when we run the query from Admin console:
where we pass q and bq param as below.

q=(((_query_:"{!synonym_edismax qf='itemname OR itemnumber OR itemdesc'
v='HTC' bq='' mm=100 synonyms=true synonyms.constructPhrases=true
synonyms.ignoreQueryOperators=true}") OR (itemname:"HTC" OR
itemnamecomp:HTC* OR itemnumber:"HTC" OR itemnumbercomp:HTC* OR
itemdesc:"HTC"~500)) AND (warehouse:Ind02 OR warehouse:Ind03 OR
warehouse:Ind04 ))
bq=warehouse:Ind02^1000

This works absolutely fine when tried from Admin cosnole.

But when we use SolrJ API , we are not geting the expected boost value
being returned in score field.

We are using SolrQuery class for adding the bq parameter.

queryEngine.set("bq", boostQuery);
where boostQuery is : warehouse:Ind02^1000
How can we handle this. Is this becuase of bq='' being used for
synonym_edismax parser?




On Tue, Sep 8, 2015 at 5:49 PM, dinesh naik <di...@gmail.com>
wrote:

> Thanks Alot Upayavira. It worked as expected.
>
>
> On Tue, Sep 8, 2015 at 2:09 PM, Upayavira <uv...@odoko.co.uk> wrote:
>
>> you can add bq= inside your {!synonym_edismax} section, if you wish and
>> it will apply to that query parser only.
>>
>> Upayavira
>>
>> On Mon, Sep 7, 2015, at 03:05 PM, dinesh naik wrote:
>> > Please find below the detail:
>> >
>> >  My main query is like this:
>> >
>> > q=(((_query_:"{!synonym_edismax qf='itemname OR itemnumber OR itemdesc'
>> > v='HTC' mm=100 synonyms=true synonyms.constructPhrases=true
>> > synonyms.ignoreQueryOperators=true}") OR (itemname:"HTC" OR
>> > itemnamecomp:HTC* OR itemnumber:"HTC" OR itemnumbercomp:HTC* OR
>> > itemdesc:"HTC"~500)) AND (warehouse:Ind02 OR warehouse:Ind03 OR
>> > warehouse:Ind04 ))
>> >
>> >  Giving Boost of 1000 for warehouse Ind02
>> >  using below parameter:
>> >
>> >  bq=warehouse:Ind02^1000
>> >
>> >
>> > Here i am expecting a boost of 1004 but , somehow 1000 is added extra
>> may
>> > be because of my additional parser. How can i avoid this?
>> >
>> >
>> > Debug information for the boost :
>> >
>> >  <str name="document1">
>> > 2004.0 = sum of:
>> >   1004.0 = sum of:
>> >     1003.0 = sum of:
>> >       1001.0 = sum of:
>> >         1.0 = max of:
>> >           1.0 = weight(itemname:HTC in 235500) [CustomSimilarity],
>> result
>> > of:
>> >             1.0 = fieldWeight in 235500, product of:
>> >               1.0 = tf(freq=1.0), with freq of:
>> >                 1.0 = termFreq=1.0
>> >               1.0 = idf(docFreq=26, maxDocs=1738053)
>> >               1.0 = fieldNorm(doc=235500)
>> >         1000.0 = weight(warehouse:e02^1000.0 in 235500)
>> >         [CustomSimilarity],
>> > result of:
>> >           1000.0 = score(doc=235500,freq=1.0), product of:
>> >             1000.0 = queryWeight, product of:
>> >               1000.0 = boost
>> >               1.0 = idf(docFreq=416190, maxDocs=1738053)
>> >               1.0 = queryNorm
>> >             1.0 = fieldWeight in 235500, product of:
>> >               1.0 = tf(freq=1.0), with freq of:
>> >                 1.0 = termFreq=1.0
>> >               1.0 = idf(docFreq=416190, maxDocs=1738053)
>> >               1.0 = fieldNorm(doc=235500)
>> >       2.0 = sum of:
>> >         1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
>> >         of:
>> >           1.0 = fieldWeight in 235500, product of:
>> >             1.0 = tf(freq=1.0), with freq of:
>> >               1.0 = termFreq=1.0
>> >             1.0 = idf(docFreq=26, maxDocs=1738053)
>> >             1.0 = fieldNorm(doc=235500)
>> >         1.0 = itemnamecomp:HTC*, product of:
>> >           1.0 = boost
>> >           1.0 = queryNorm
>> >     1.0 = sum of:
>> >       1.0 = weight(warehouse:e02 in 235500) [CustomSimilarity], result
>> >       of:
>> >         1.0 = fieldWeight in 235500, product of:
>> >           1.0 = tf(freq=1.0), with freq of:
>> >             1.0 = termFreq=1.0
>> >           1.0 = idf(docFreq=416190, maxDocs=1738053)
>> >           1.0 = fieldNorm(doc=235500)
>> >   1000.0 = weight(warehouse:e02^1000.0 in 235500) [CustomSimilarity],
>> > result of:
>> >     1000.0 = score(doc=235500,freq=1.0), product of:
>> >       1000.0 = queryWeight, product of:
>> >         1000.0 = boost
>> >         1.0 = idf(docFreq=416190, maxDocs=1738053)
>> >         1.0 = queryNorm
>> >       1.0 = fieldWeight in 235500, product of:
>> >         1.0 = tf(freq=1.0), with freq of:
>> >           1.0 = termFreq=1.0
>> >         1.0 = idf(docFreq=416190, maxDocs=1738053)
>> >         1.0 = fieldNorm(doc=235500)
>> > </str>
>> >
>> > On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
>> > wrote:
>> > Hi all,
>> >
>> > Is there a way to apply different boost , using bq parameter for
>> > different
>> > parser.
>> >
>> > for example if i am using a synonym parser and edismax parser in a
>> single
>> > query, my bq param value is getting applied for both the parser making
>> > the
>> > boost value double.
>> >
>> > --
>> > Best Regards,
>> > Dinesh Naik
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
>> > wrote:
>> >
>> > > Hi all,
>> > >
>> > > Is there a way to apply different boost , using bq parameter for
>> different
>> > > parser.
>> > >
>> > > for example if i am using a synonym parser and edismax parser in a
>> single
>> > > query, my bq param value is getting applied for both the parser
>> making the
>> > > boost value double.
>> > >
>> > > --
>> > > Best Regards,
>> > > Dinesh Naik
>> > >
>> >
>> >
>> >
>> > --
>> > Best Regards,
>> > Dinesh Naik
>>
>
>
>
> --
> Best Regards,
> Dinesh Naik
>



-- 
Best Regards,
Dinesh Naik

Re: Different boost values for multiple parsers in Solr 5.2.1

Posted by dinesh naik <di...@gmail.com>.
Thanks Alot Upayavira. It worked as expected.


On Tue, Sep 8, 2015 at 2:09 PM, Upayavira <uv...@odoko.co.uk> wrote:

> you can add bq= inside your {!synonym_edismax} section, if you wish and
> it will apply to that query parser only.
>
> Upayavira
>
> On Mon, Sep 7, 2015, at 03:05 PM, dinesh naik wrote:
> > Please find below the detail:
> >
> >  My main query is like this:
> >
> > q=(((_query_:"{!synonym_edismax qf='itemname OR itemnumber OR itemdesc'
> > v='HTC' mm=100 synonyms=true synonyms.constructPhrases=true
> > synonyms.ignoreQueryOperators=true}") OR (itemname:"HTC" OR
> > itemnamecomp:HTC* OR itemnumber:"HTC" OR itemnumbercomp:HTC* OR
> > itemdesc:"HTC"~500)) AND (warehouse:Ind02 OR warehouse:Ind03 OR
> > warehouse:Ind04 ))
> >
> >  Giving Boost of 1000 for warehouse Ind02
> >  using below parameter:
> >
> >  bq=warehouse:Ind02^1000
> >
> >
> > Here i am expecting a boost of 1004 but , somehow 1000 is added extra may
> > be because of my additional parser. How can i avoid this?
> >
> >
> > Debug information for the boost :
> >
> >  <str name="document1">
> > 2004.0 = sum of:
> >   1004.0 = sum of:
> >     1003.0 = sum of:
> >       1001.0 = sum of:
> >         1.0 = max of:
> >           1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
> > of:
> >             1.0 = fieldWeight in 235500, product of:
> >               1.0 = tf(freq=1.0), with freq of:
> >                 1.0 = termFreq=1.0
> >               1.0 = idf(docFreq=26, maxDocs=1738053)
> >               1.0 = fieldNorm(doc=235500)
> >         1000.0 = weight(warehouse:e02^1000.0 in 235500)
> >         [CustomSimilarity],
> > result of:
> >           1000.0 = score(doc=235500,freq=1.0), product of:
> >             1000.0 = queryWeight, product of:
> >               1000.0 = boost
> >               1.0 = idf(docFreq=416190, maxDocs=1738053)
> >               1.0 = queryNorm
> >             1.0 = fieldWeight in 235500, product of:
> >               1.0 = tf(freq=1.0), with freq of:
> >                 1.0 = termFreq=1.0
> >               1.0 = idf(docFreq=416190, maxDocs=1738053)
> >               1.0 = fieldNorm(doc=235500)
> >       2.0 = sum of:
> >         1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
> >         of:
> >           1.0 = fieldWeight in 235500, product of:
> >             1.0 = tf(freq=1.0), with freq of:
> >               1.0 = termFreq=1.0
> >             1.0 = idf(docFreq=26, maxDocs=1738053)
> >             1.0 = fieldNorm(doc=235500)
> >         1.0 = itemnamecomp:HTC*, product of:
> >           1.0 = boost
> >           1.0 = queryNorm
> >     1.0 = sum of:
> >       1.0 = weight(warehouse:e02 in 235500) [CustomSimilarity], result
> >       of:
> >         1.0 = fieldWeight in 235500, product of:
> >           1.0 = tf(freq=1.0), with freq of:
> >             1.0 = termFreq=1.0
> >           1.0 = idf(docFreq=416190, maxDocs=1738053)
> >           1.0 = fieldNorm(doc=235500)
> >   1000.0 = weight(warehouse:e02^1000.0 in 235500) [CustomSimilarity],
> > result of:
> >     1000.0 = score(doc=235500,freq=1.0), product of:
> >       1000.0 = queryWeight, product of:
> >         1000.0 = boost
> >         1.0 = idf(docFreq=416190, maxDocs=1738053)
> >         1.0 = queryNorm
> >       1.0 = fieldWeight in 235500, product of:
> >         1.0 = tf(freq=1.0), with freq of:
> >           1.0 = termFreq=1.0
> >         1.0 = idf(docFreq=416190, maxDocs=1738053)
> >         1.0 = fieldNorm(doc=235500)
> > </str>
> >
> > On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
> > wrote:
> > Hi all,
> >
> > Is there a way to apply different boost , using bq parameter for
> > different
> > parser.
> >
> > for example if i am using a synonym parser and edismax parser in a single
> > query, my bq param value is getting applied for both the parser making
> > the
> > boost value double.
> >
> > --
> > Best Regards,
> > Dinesh Naik
> >
> >
> >
> >
> >
> > On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
> > wrote:
> >
> > > Hi all,
> > >
> > > Is there a way to apply different boost , using bq parameter for
> different
> > > parser.
> > >
> > > for example if i am using a synonym parser and edismax parser in a
> single
> > > query, my bq param value is getting applied for both the parser making
> the
> > > boost value double.
> > >
> > > --
> > > Best Regards,
> > > Dinesh Naik
> > >
> >
> >
> >
> > --
> > Best Regards,
> > Dinesh Naik
>



-- 
Best Regards,
Dinesh Naik

Re: Different boost values for multiple parsers in Solr 5.2.1

Posted by Upayavira <uv...@odoko.co.uk>.
you can add bq= inside your {!synonym_edismax} section, if you wish and
it will apply to that query parser only.

Upayavira

On Mon, Sep 7, 2015, at 03:05 PM, dinesh naik wrote:
> Please find below the detail:
> 
>  My main query is like this:
> 
> q=(((_query_:"{!synonym_edismax qf='itemname OR itemnumber OR itemdesc'
> v='HTC' mm=100 synonyms=true synonyms.constructPhrases=true
> synonyms.ignoreQueryOperators=true}") OR (itemname:"HTC" OR
> itemnamecomp:HTC* OR itemnumber:"HTC" OR itemnumbercomp:HTC* OR
> itemdesc:"HTC"~500)) AND (warehouse:Ind02 OR warehouse:Ind03 OR
> warehouse:Ind04 ))
> 
>  Giving Boost of 1000 for warehouse Ind02
>  using below parameter:
> 
>  bq=warehouse:Ind02^1000
> 
> 
> Here i am expecting a boost of 1004 but , somehow 1000 is added extra may
> be because of my additional parser. How can i avoid this?
> 
> 
> Debug information for the boost :
> 
>  <str name="document1">
> 2004.0 = sum of:
>   1004.0 = sum of:
>     1003.0 = sum of:
>       1001.0 = sum of:
>         1.0 = max of:
>           1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
> of:
>             1.0 = fieldWeight in 235500, product of:
>               1.0 = tf(freq=1.0), with freq of:
>                 1.0 = termFreq=1.0
>               1.0 = idf(docFreq=26, maxDocs=1738053)
>               1.0 = fieldNorm(doc=235500)
>         1000.0 = weight(warehouse:e02^1000.0 in 235500)
>         [CustomSimilarity],
> result of:
>           1000.0 = score(doc=235500,freq=1.0), product of:
>             1000.0 = queryWeight, product of:
>               1000.0 = boost
>               1.0 = idf(docFreq=416190, maxDocs=1738053)
>               1.0 = queryNorm
>             1.0 = fieldWeight in 235500, product of:
>               1.0 = tf(freq=1.0), with freq of:
>                 1.0 = termFreq=1.0
>               1.0 = idf(docFreq=416190, maxDocs=1738053)
>               1.0 = fieldNorm(doc=235500)
>       2.0 = sum of:
>         1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
>         of:
>           1.0 = fieldWeight in 235500, product of:
>             1.0 = tf(freq=1.0), with freq of:
>               1.0 = termFreq=1.0
>             1.0 = idf(docFreq=26, maxDocs=1738053)
>             1.0 = fieldNorm(doc=235500)
>         1.0 = itemnamecomp:HTC*, product of:
>           1.0 = boost
>           1.0 = queryNorm
>     1.0 = sum of:
>       1.0 = weight(warehouse:e02 in 235500) [CustomSimilarity], result
>       of:
>         1.0 = fieldWeight in 235500, product of:
>           1.0 = tf(freq=1.0), with freq of:
>             1.0 = termFreq=1.0
>           1.0 = idf(docFreq=416190, maxDocs=1738053)
>           1.0 = fieldNorm(doc=235500)
>   1000.0 = weight(warehouse:e02^1000.0 in 235500) [CustomSimilarity],
> result of:
>     1000.0 = score(doc=235500,freq=1.0), product of:
>       1000.0 = queryWeight, product of:
>         1000.0 = boost
>         1.0 = idf(docFreq=416190, maxDocs=1738053)
>         1.0 = queryNorm
>       1.0 = fieldWeight in 235500, product of:
>         1.0 = tf(freq=1.0), with freq of:
>           1.0 = termFreq=1.0
>         1.0 = idf(docFreq=416190, maxDocs=1738053)
>         1.0 = fieldNorm(doc=235500)
> </str>
> 
> On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
> wrote:
> Hi all,
> 
> Is there a way to apply different boost , using bq parameter for
> different
> parser.
> 
> for example if i am using a synonym parser and edismax parser in a single
> query, my bq param value is getting applied for both the parser making
> the
> boost value double.
> 
> -- 
> Best Regards,
> Dinesh Naik
> 
> 
> 
> 
> 
> On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
> wrote:
> 
> > Hi all,
> >
> > Is there a way to apply different boost , using bq parameter for different
> > parser.
> >
> > for example if i am using a synonym parser and edismax parser in a single
> > query, my bq param value is getting applied for both the parser making the
> > boost value double.
> >
> > --
> > Best Regards,
> > Dinesh Naik
> >
> 
> 
> 
> -- 
> Best Regards,
> Dinesh Naik

Re: Different boost values for multiple parsers in Solr 5.2.1

Posted by dinesh naik <di...@gmail.com>.
Please find below the detail:

 My main query is like this:

q=(((_query_:"{!synonym_edismax qf='itemname OR itemnumber OR itemdesc'
v='HTC' mm=100 synonyms=true synonyms.constructPhrases=true
synonyms.ignoreQueryOperators=true}") OR (itemname:"HTC" OR
itemnamecomp:HTC* OR itemnumber:"HTC" OR itemnumbercomp:HTC* OR
itemdesc:"HTC"~500)) AND (warehouse:Ind02 OR warehouse:Ind03 OR
warehouse:Ind04 ))

 Giving Boost of 1000 for warehouse Ind02
 using below parameter:

 bq=warehouse:Ind02^1000


Here i am expecting a boost of 1004 but , somehow 1000 is added extra may
be because of my additional parser. How can i avoid this?


Debug information for the boost :

 <str name="document1">
2004.0 = sum of:
  1004.0 = sum of:
    1003.0 = sum of:
      1001.0 = sum of:
        1.0 = max of:
          1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result
of:
            1.0 = fieldWeight in 235500, product of:
              1.0 = tf(freq=1.0), with freq of:
                1.0 = termFreq=1.0
              1.0 = idf(docFreq=26, maxDocs=1738053)
              1.0 = fieldNorm(doc=235500)
        1000.0 = weight(warehouse:e02^1000.0 in 235500) [CustomSimilarity],
result of:
          1000.0 = score(doc=235500,freq=1.0), product of:
            1000.0 = queryWeight, product of:
              1000.0 = boost
              1.0 = idf(docFreq=416190, maxDocs=1738053)
              1.0 = queryNorm
            1.0 = fieldWeight in 235500, product of:
              1.0 = tf(freq=1.0), with freq of:
                1.0 = termFreq=1.0
              1.0 = idf(docFreq=416190, maxDocs=1738053)
              1.0 = fieldNorm(doc=235500)
      2.0 = sum of:
        1.0 = weight(itemname:HTC in 235500) [CustomSimilarity], result of:
          1.0 = fieldWeight in 235500, product of:
            1.0 = tf(freq=1.0), with freq of:
              1.0 = termFreq=1.0
            1.0 = idf(docFreq=26, maxDocs=1738053)
            1.0 = fieldNorm(doc=235500)
        1.0 = itemnamecomp:HTC*, product of:
          1.0 = boost
          1.0 = queryNorm
    1.0 = sum of:
      1.0 = weight(warehouse:e02 in 235500) [CustomSimilarity], result of:
        1.0 = fieldWeight in 235500, product of:
          1.0 = tf(freq=1.0), with freq of:
            1.0 = termFreq=1.0
          1.0 = idf(docFreq=416190, maxDocs=1738053)
          1.0 = fieldNorm(doc=235500)
  1000.0 = weight(warehouse:e02^1000.0 in 235500) [CustomSimilarity],
result of:
    1000.0 = score(doc=235500,freq=1.0), product of:
      1000.0 = queryWeight, product of:
        1000.0 = boost
        1.0 = idf(docFreq=416190, maxDocs=1738053)
        1.0 = queryNorm
      1.0 = fieldWeight in 235500, product of:
        1.0 = tf(freq=1.0), with freq of:
          1.0 = termFreq=1.0
        1.0 = idf(docFreq=416190, maxDocs=1738053)
        1.0 = fieldNorm(doc=235500)
</str>

On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
wrote:
Hi all,

Is there a way to apply different boost , using bq parameter for different
parser.

for example if i am using a synonym parser and edismax parser in a single
query, my bq param value is getting applied for both the parser making the
boost value double.

-- 
Best Regards,
Dinesh Naik





On Mon, Sep 7, 2015 at 7:21 PM, dinesh naik <di...@gmail.com>
wrote:

> Hi all,
>
> Is there a way to apply different boost , using bq parameter for different
> parser.
>
> for example if i am using a synonym parser and edismax parser in a single
> query, my bq param value is getting applied for both the parser making the
> boost value double.
>
> --
> Best Regards,
> Dinesh Naik
>



-- 
Best Regards,
Dinesh Naik