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 "Miller, Will Jr" <Wi...@wolterskluwer.com> on 2013/03/23 00:07:27 UTC

Boost query parameter with Lucid parser and using query FunctionQuery

I have been playing around with the bq/bf/boost query parameters available in dismax/edismax. I am using the Lucid parser as my default parser for the query. The lucid parser is an extension of the DisMax parser and should contain everything that is available in that  parser. My goal is boost items that have the word treatment in the title field. I started with the bq parameter and this works but it is an additive boost. I would prefer a multiplicative boost so I started to look at using boost which is part of edismax.

This is my full query:
/lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&debugQuery=true&boost=product(10,query({!dismax qf="title" v="treatment"},0))
What I see in the debug data:

  <str name="parsedquery">BoostedQuery(boost((abstract:blood | author:blood | origtitle:blood | substance:blood | text_all:blood | title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0))))</str>
  <str name="parsedquery_toString">boost((abstract:blood | author:blood | origtitle:blood | substance:blood | text_all:blood | title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0)))</str>

In the boost query I am specifying the field as title but it is expanding to look in all of the fields.

How do I restrict the boost query to just look in the title field?

Thanks,
Will

RE: Boost query parameter with Lucid parser and using query FunctionQuery

Posted by "Miller, Will Jr" <Wi...@wolterskluwer.com>.
Thanks for the suggestion.

Doesn't look like it makes a difference and it is still ignoring the qf parameter in the FunctionQuery...
<str name="parsedquery">BoostedQuery(boost((abstract:cancer | author:cancer | origtitle:cancer | substance:cancer | text_all:cancer | title:cancer^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0))))</str>
<str name="parsedquery_toString">boost((abstract:cancer | author:cancer | origtitle:cancer | substance:cancer | text_all:cancer | title:cancer^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0)))</str>

qq=title:treatment does appear to work though. Ultimately I am not tied to using the dismax parser and I am not sure what the final boost query will be. For now I will try to avoid using dismax and will continue to play around with it.

Thanks again,
Will

-----Original Message-----
From: Jan Høydahl [mailto:jan.asf@cominvent.com] 
Sent: Saturday, March 23, 2013 7:51 PM
To: solr-user@lucene.apache.org
Subject: Re: Boost query parameter with Lucid parser and using query FunctionQuery

I think perhaps the reason it won't work is that functions cannot contain spaces, so you should use variable substitutions instead

&boost=product(10,query($qq,0))&qq={!dismax qf="title" v="treatment"}

But why do you use dismax for the query() function when a simple qq=title:treatment would do?

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

23. mars 2013 kl. 01:26 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:

> This is the echo params... It looks like it ignores the qf in the FunctionQuery and instead takes the qf of the main query.
> 
> <lst name="params">
> 	<str name="spellcheck">true</str>
> 	<str name="facet">true</str>
> 	<str name="sort">score desc</str>
> 	<str name="facet.limit">11</str>
> 	<str name="q.alt">*:*</str>
> 	<str name="showFindSimilarLinks">true</str>
> 	<str name="f.body.hl.alternateField">body</str>
> 	<str name="hl">true</str>
> 	<str name="stopwords.enabled">true</str>
> 	<str name="feedback">false</str>
> 	<str name="echoParams">all</str>
> 	<str name="fl">title,score</str>
> 	<str name="f.body.hl.maxAlternateFieldLength">250</str>
> 	<arr name="role">
> 		<str>DEFAULT</str>	
> 		<str>DEFAULT</str>
> 	</arr>
> 	<arr name="facet.field">
> 		<str>author_display</str>
> 		<str>data_source_name</str>
> 		<str>keywords_display</str>
> 		<str>mimeType</str>
> 	</arr>
> 	<str name="synonyms.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,text_all,title</str>
> 	<str name="auto-complete">true</str>
> 	<str name="likeDoc.fl">author,title</str>
> 	<str name="facet.mincount">1</str>
> 	<str name="feedback.emphasis">relevancy</str>
> 	<str name="qf">abstract author origtitle substance text_all title^5.0</str>
> 	<str name="hl.fl">abstract,author,authorfullname,authorlast,body,comments,country,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,substance,title</str>
> 	<str name="spellcheck.collate">true</str>
> 	<str name="spellcheck.onlyMorePopular">true</str>
> 	<str name="defType">lucid</str>
> 	<str name="pf">abstract substance author title^5.0 text_all origtitle</str>
> 	<str name="stopwords.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,keywords,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,title</str>
> 	<str name="boost">product(10,query({!dismax qf="title" v="treatment"},0))</str>
> 	<str name="synonyms.enabled">true</str>
> 	<str name="debugQuery">true</str>
> 	<str name="indent">true</str>
> 	<str name="q">cancer</str>
> 	<str name="wt">xml</str>
> </lst>
> 
> -----Original Message-----
> From: Jan Høydahl [mailto:jan.asf@cominvent.com]
> Sent: Friday, March 22, 2013 8:07 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Boost query parameter with Lucid parser and using query 
> FunctionQuery
> 
> Why would you use dismax for the query() when you want to match a simple term to one field?
> 
> If you share &echoParams=all the answer may lie somewhere therein?
> 
> --
> Jan Høydahl, search solution architect Cominvent AS - 
> www.cominvent.com Solr Training - www.solrtraining.com
> 
> 23. mars 2013 kl. 00:07 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:
> 
>> I have been playing around with the bq/bf/boost query parameters available in dismax/edismax. I am using the Lucid parser as my default parser for the query. The lucid parser is an extension of the DisMax parser and should contain everything that is available in that  parser. My goal is boost items that have the word treatment in the title field. I started with the bq parameter and this works but it is an additive boost. I would prefer a multiplicative boost so I started to look at using boost which is part of edismax.
>> 
>> This is my full query:
>> /lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&deb
>> u gQuery=true&boost=product(10,query({!dismax qf="title" 
>> v="treatment"},0)) What I see in the debug data:
>> 
>> <str name="parsedquery">BoostedQuery(boost((abstract:blood | 
>> author:blood | origtitle:blood | substance:blood | text_all:blood |
>> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment)
>> (abstract:treatment | author:treatment | substance:treatment |
>> title:treatment^5.0 | text_all:treatment | 
>> origtitle:treatment),def=0.0))))</str>
>> <str name="parsedquery_toString">boost((abstract:blood | author:blood
>> | origtitle:blood | substance:blood | text_all:blood |
>> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment)
>> (abstract:treatment | author:treatment | substance:treatment |
>> title:treatment^5.0 | text_all:treatment | 
>> origtitle:treatment),def=0.0)))</str>
>> 
>> In the boost query I am specifying the field as title but it is expanding to look in all of the fields.
>> 
>> How do I restrict the boost query to just look in the title field?
>> 
>> Thanks,
>> Will
> 


Re: Boost query parameter with Lucid parser and using query FunctionQuery

Posted by Jan Høydahl <ja...@cominvent.com>.
I think perhaps the reason it won't work is that functions cannot contain spaces, so you should use variable substitutions instead

&boost=product(10,query($qq,0))&qq={!dismax qf="title" v="treatment"}

But why do you use dismax for the query() function when a simple qq=title:treatment would do?

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

23. mars 2013 kl. 01:26 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:

> This is the echo params... It looks like it ignores the qf in the FunctionQuery and instead takes the qf of the main query.
> 
> <lst name="params">
> 	<str name="spellcheck">true</str>
> 	<str name="facet">true</str>
> 	<str name="sort">score desc</str>
> 	<str name="facet.limit">11</str>
> 	<str name="q.alt">*:*</str>
> 	<str name="showFindSimilarLinks">true</str>
> 	<str name="f.body.hl.alternateField">body</str>
> 	<str name="hl">true</str>
> 	<str name="stopwords.enabled">true</str>
> 	<str name="feedback">false</str>
> 	<str name="echoParams">all</str>
> 	<str name="fl">title,score</str>
> 	<str name="f.body.hl.maxAlternateFieldLength">250</str>
> 	<arr name="role">
> 		<str>DEFAULT</str>	
> 		<str>DEFAULT</str>
> 	</arr>
> 	<arr name="facet.field">
> 		<str>author_display</str>
> 		<str>data_source_name</str>
> 		<str>keywords_display</str>
> 		<str>mimeType</str>
> 	</arr>
> 	<str name="synonyms.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,text_all,title</str>
> 	<str name="auto-complete">true</str>
> 	<str name="likeDoc.fl">author,title</str>
> 	<str name="facet.mincount">1</str>
> 	<str name="feedback.emphasis">relevancy</str>
> 	<str name="qf">abstract author origtitle substance text_all title^5.0</str>
> 	<str name="hl.fl">abstract,author,authorfullname,authorlast,body,comments,country,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,substance,title</str>
> 	<str name="spellcheck.collate">true</str>
> 	<str name="spellcheck.onlyMorePopular">true</str>
> 	<str name="defType">lucid</str>
> 	<str name="pf">abstract substance author title^5.0 text_all origtitle</str>
> 	<str name="stopwords.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,keywords,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,title</str>
> 	<str name="boost">product(10,query({!dismax qf="title" v="treatment"},0))</str>
> 	<str name="synonyms.enabled">true</str>
> 	<str name="debugQuery">true</str>
> 	<str name="indent">true</str>
> 	<str name="q">cancer</str>
> 	<str name="wt">xml</str>
> </lst>
> 
> -----Original Message-----
> From: Jan Høydahl [mailto:jan.asf@cominvent.com] 
> Sent: Friday, March 22, 2013 8:07 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Boost query parameter with Lucid parser and using query FunctionQuery
> 
> Why would you use dismax for the query() when you want to match a simple term to one field?
> 
> If you share &echoParams=all the answer may lie somewhere therein?
> 
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
> Solr Training - www.solrtraining.com
> 
> 23. mars 2013 kl. 00:07 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:
> 
>> I have been playing around with the bq/bf/boost query parameters available in dismax/edismax. I am using the Lucid parser as my default parser for the query. The lucid parser is an extension of the DisMax parser and should contain everything that is available in that  parser. My goal is boost items that have the word treatment in the title field. I started with the bq parameter and this works but it is an additive boost. I would prefer a multiplicative boost so I started to look at using boost which is part of edismax.
>> 
>> This is my full query:
>> /lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&debu
>> gQuery=true&boost=product(10,query({!dismax qf="title" v="treatment"},0)) What I see in the debug data:
>> 
>> <str name="parsedquery">BoostedQuery(boost((abstract:blood | 
>> author:blood | origtitle:blood | substance:blood | text_all:blood | 
>> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
>> (abstract:treatment | author:treatment | substance:treatment | 
>> title:treatment^5.0 | text_all:treatment | 
>> origtitle:treatment),def=0.0))))</str>
>> <str name="parsedquery_toString">boost((abstract:blood | author:blood 
>> | origtitle:blood | substance:blood | text_all:blood | 
>> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
>> (abstract:treatment | author:treatment | substance:treatment | 
>> title:treatment^5.0 | text_all:treatment | 
>> origtitle:treatment),def=0.0)))</str>
>> 
>> In the boost query I am specifying the field as title but it is expanding to look in all of the fields.
>> 
>> How do I restrict the boost query to just look in the title field?
>> 
>> Thanks,
>> Will
> 


RE: Boost query parameter with Lucid parser and using query FunctionQuery

Posted by "Miller, Will Jr" <Wi...@wolterskluwer.com>.
This is the echo params... It looks like it ignores the qf in the FunctionQuery and instead takes the qf of the main query.

<lst name="params">
	<str name="spellcheck">true</str>
	<str name="facet">true</str>
	<str name="sort">score desc</str>
	<str name="facet.limit">11</str>
	<str name="q.alt">*:*</str>
	<str name="showFindSimilarLinks">true</str>
	<str name="f.body.hl.alternateField">body</str>
	<str name="hl">true</str>
	<str name="stopwords.enabled">true</str>
	<str name="feedback">false</str>
	<str name="echoParams">all</str>
	<str name="fl">title,score</str>
	<str name="f.body.hl.maxAlternateFieldLength">250</str>
	<arr name="role">
		<str>DEFAULT</str>	
		<str>DEFAULT</str>
	</arr>
	<arr name="facet.field">
		<str>author_display</str>
		<str>data_source_name</str>
		<str>keywords_display</str>
		<str>mimeType</str>
	</arr>
	<str name="synonyms.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,text_all,title</str>
	<str name="auto-complete">true</str>
	<str name="likeDoc.fl">author,title</str>
	<str name="facet.mincount">1</str>
	<str name="feedback.emphasis">relevancy</str>
	<str name="qf">abstract author origtitle substance text_all title^5.0</str>
	<str name="hl.fl">abstract,author,authorfullname,authorlast,body,comments,country,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,substance,title</str>
	<str name="spellcheck.collate">true</str>
	<str name="spellcheck.onlyMorePopular">true</str>
	<str name="defType">lucid</str>
	<str name="pf">abstract substance author title^5.0 text_all origtitle</str>
	<str name="stopwords.fields">abstract,body,comments,country,description,diseaseconcept,genesymbol,grant,institution,investigator,investigatoraffiliation,keywordheading,keywords,nlmjournalname,origtitle,otherabstract,personname,primaryauthor,protocolconcept,spaceflight,substance,title</str>
	<str name="boost">product(10,query({!dismax qf="title" v="treatment"},0))</str>
	<str name="synonyms.enabled">true</str>
	<str name="debugQuery">true</str>
	<str name="indent">true</str>
	<str name="q">cancer</str>
	<str name="wt">xml</str>
</lst>

-----Original Message-----
From: Jan Høydahl [mailto:jan.asf@cominvent.com] 
Sent: Friday, March 22, 2013 8:07 PM
To: solr-user@lucene.apache.org
Subject: Re: Boost query parameter with Lucid parser and using query FunctionQuery

Why would you use dismax for the query() when you want to match a simple term to one field?

If you share &echoParams=all the answer may lie somewhere therein?

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

23. mars 2013 kl. 00:07 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:

> I have been playing around with the bq/bf/boost query parameters available in dismax/edismax. I am using the Lucid parser as my default parser for the query. The lucid parser is an extension of the DisMax parser and should contain everything that is available in that  parser. My goal is boost items that have the word treatment in the title field. I started with the bq parameter and this works but it is an additive boost. I would prefer a multiplicative boost so I started to look at using boost which is part of edismax.
> 
> This is my full query:
> /lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&debu
> gQuery=true&boost=product(10,query({!dismax qf="title" v="treatment"},0)) What I see in the debug data:
> 
>  <str name="parsedquery">BoostedQuery(boost((abstract:blood | 
> author:blood | origtitle:blood | substance:blood | text_all:blood | 
> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
> (abstract:treatment | author:treatment | substance:treatment | 
> title:treatment^5.0 | text_all:treatment | 
> origtitle:treatment),def=0.0))))</str>
>  <str name="parsedquery_toString">boost((abstract:blood | author:blood 
> | origtitle:blood | substance:blood | text_all:blood | 
> title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
> (abstract:treatment | author:treatment | substance:treatment | 
> title:treatment^5.0 | text_all:treatment | 
> origtitle:treatment),def=0.0)))</str>
> 
> In the boost query I am specifying the field as title but it is expanding to look in all of the fields.
> 
> How do I restrict the boost query to just look in the title field?
> 
> Thanks,
> Will


Re: Boost query parameter with Lucid parser and using query FunctionQuery

Posted by Jan Høydahl <ja...@cominvent.com>.
Why would you use dismax for the query() when you want to match a simple term to one field?

If you share &echoParams=all the answer may lie somewhere therein?

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

23. mars 2013 kl. 00:07 skrev "Miller, Will Jr" <Wi...@wolterskluwer.com>:

> I have been playing around with the bq/bf/boost query parameters available in dismax/edismax. I am using the Lucid parser as my default parser for the query. The lucid parser is an extension of the DisMax parser and should contain everything that is available in that  parser. My goal is boost items that have the word treatment in the title field. I started with the bq parameter and this works but it is an additive boost. I would prefer a multiplicative boost so I started to look at using boost which is part of edismax.
> 
> This is my full query:
> /lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&debugQuery=true&boost=product(10,query({!dismax qf="title" v="treatment"},0))
> What I see in the debug data:
> 
>  <str name="parsedquery">BoostedQuery(boost((abstract:blood | author:blood | origtitle:blood | substance:blood | text_all:blood | title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0))))</str>
>  <str name="parsedquery_toString">boost((abstract:blood | author:blood | origtitle:blood | substance:blood | text_all:blood | title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) (abstract:treatment | author:treatment | substance:treatment | title:treatment^5.0 | text_all:treatment | origtitle:treatment),def=0.0)))</str>
> 
> In the boost query I am specifying the field as title but it is expanding to look in all of the fields.
> 
> How do I restrict the boost query to just look in the title field?
> 
> Thanks,
> Will


Re: Boost query parameter with Lucid parser and using query FunctionQuery

Posted by Jack Krupansky <ja...@basetechnology.com>.
You'll have to contact Lucid's support for questions about their code. (I've 
been away from that code too long to recall much about it.)

-- Jack Krupansky

-----Original Message----- 
From: Miller, Will Jr
Sent: Friday, March 22, 2013 7:07 PM
To: solr-user@lucene.apache.org
Subject: Boost query parameter with Lucid parser and using query 
FunctionQuery

I have been playing around with the bq/bf/boost query parameters available 
in dismax/edismax. I am using the Lucid parser as my default parser for the 
query. The lucid parser is an extension of the DisMax parser and should 
contain everything that is available in that  parser. My goal is boost items 
that have the word treatment in the title field. I started with the bq 
parameter and this works but it is an additive boost. I would prefer a 
multiplicative boost so I started to look at using boost which is part of 
edismax.

This is my full query:
/lucid?q=cancer&sort=score+desc&fl=title,score&wt=xml&indent=true&debugQuery=true&boost=product(10,query({!dismax 
qf="title" v="treatment"},0))
What I see in the debug data:

  <str name="parsedquery">BoostedQuery(boost((abstract:blood | author:blood 
| origtitle:blood | substance:blood | text_all:blood | 
title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
(abstract:treatment | author:treatment | substance:treatment | 
title:treatment^5.0 | text_all:treatment | 
origtitle:treatment),def=0.0))))</str>
  <str name="parsedquery_toString">boost((abstract:blood | author:blood | 
origtitle:blood | substance:blood | text_all:blood | 
title:blood^5.0)~0.01,product(const(10),query(+(title:treatment) 
(abstract:treatment | author:treatment | substance:treatment | 
title:treatment^5.0 | text_all:treatment | 
origtitle:treatment),def=0.0)))</str>

In the boost query I am specifying the field as title but it is expanding to 
look in all of the fields.

How do I restrict the boost query to just look in the title field?

Thanks,
Will