Boosting on field empty or not
Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky wrote: > In a query or filter query you can write +field:* to require that a field > be populated or +(-field:*) to require that it not be populated > > -- Jack Krupansky > > -Original Message- From: Donald Organ > Sent: Monday, May 14, 2012 2:10 PM > To: solr-user > Subject: Boosting on field empty or not > > Is there a way to boost a document based on whether the field is empty or > not. I am looking to boost documents that have a specific field > populated. >
Re: Boosting on field empty or not
foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky wrote: > foo AND (field:*^2.0 OR (-field:*)^0.5) > > So, if a doc has anything in the field, it gets boosted, and if the doc > does not have anything in the field, de-boost it. Choose the boost factors > to suit your desired boosting effect. > > -- Jack Krupansky > > -Original Message- From: Donald Organ > Sent: Monday, May 14, 2012 2:38 PM > To: solr-user@lucene.apache.org > Subject: Re: Boosting on field empty or not > > OK maybe i need to describe this a little more. > > Basically I want documents that have a given field populated to have a > higher score than the documents that dont. So if you search for foo I want > documents that contain foo, but i want the documents that have field a > populated to have a higher score... > > Is there a way to do this? > > > > On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky * > *wrote: > > In a query or filter query you can write +field:* to require that a field >> be populated or +(-field:*) to require that it not be populated >> >> -- Jack Krupansky >> >> -----Original Message----- From: Donald Organ >> Sent: Monday, May 14, 2012 2:10 PM >> To: solr-user >> Subject: Boosting on field empty or not >> >> Is there a way to boost a document based on whether the field is empty or >> not. I am looking to boost documents that have a specific field >> populated. >> >> >
Re: Boosting on field empty or not
Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky * *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky wrote: > Sorry, make that: > > &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) > > I forgot that pure negative queries are broken again, so you need the *:* > in there. > > I noticed that you second boost operator was missing as well. > > -- Jack Krupansky > > -Original Message- From: Donald Organ > Sent: Monday, May 14, 2012 3:24 PM > To: solr-user@lucene.apache.org > Subject: Re: Boosting on field empty or not > > OK i just tried: > > &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) > > > And that gives me 0 results > > > On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky * > *wrote: > > foo AND (field:*^2.0 OR (-field:*)^0.5) >> >> So, if a doc has anything in the field, it gets boosted, and if the doc >> does not have anything in the field, de-boost it. Choose the boost factors >> to suit your desired boosting effect. >> >> -- Jack Krupansky >> >> -Original Message- From: Donald Organ >> Sent: Monday, May 14, 2012 2:38 PM >> To: solr-user@lucene.apache.org >> Subject: Re: Boosting on field empty or not >> >> OK maybe i need to describe this a little more. >> >> Basically I want documents that have a given field populated to have a >> higher score than the documents that dont. So if you search for foo I >> want >> documents that contain foo, but i want the documents that have field a >> populated to have a higher score... >> >> Is there a way to do this? >> >> >> >> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky > >* >> *wrote: >> >> In a query or filter query you can write +field:* to require that a field >> >>> be populated or +(-field:*) to require that it not be populated >>> >>> -- Jack Krupansky >>> >>> -Original Message- From: Donald Organ >>> Sent: Monday, May 14, 2012 2:10 PM >>> To: solr-user >>> Subject: Boosting on field empty or not >>> >>> Is there a way to boost a document based on whether the field is empty or >>> not. I am looking to boost documents that have a specific field >>> populated. >>> >>> >>> >> >
Re: Boosting on field empty or not
"(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky * *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky * *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
OK i must be missing something: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky wrote: > "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the > missing boost operator. > > -- Jack Krupansky > > -Original Message- From: Donald Organ > Sent: Monday, May 14, 2012 3:31 PM > To: solr-user@lucene.apache.org > Subject: Re: Boosting on field empty or not > > Still doesnt appear to be working. Here is the full Query string: > > > defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 > codeTXT^2 description^1 brand_search^0 > cat_search^10&spellcheck=true&**spellcheck.collate=true&** > spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs > AND (regularprice:*^5 OR (*:* -regularprice:*)5) > > > On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky * > *wrote: > > Sorry, make that: >> >> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >> >> I forgot that pure negative queries are broken again, so you need the *:* >> in there. >> >> I noticed that you second boost operator was missing as well. >> >> -- Jack Krupansky >> >> -Original Message- From: Donald Organ >> Sent: Monday, May 14, 2012 3:24 PM >> To: solr-user@lucene.apache.org >> Subject: Re: Boosting on field empty or not >> >> OK i just tried: >> >> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >> >> >> And that gives me 0 results >> >> >> On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky > >* >> *wrote: >> >> foo AND (field:*^2.0 OR (-field:*)^0.5) >> >>> >>> So, if a doc has anything in the field, it gets boosted, and if the doc >>> does not have anything in the field, de-boost it. Choose the boost >>> factors >>> to suit your desired boosting effect. >>> >>> -- Jack Krupansky >>> >>> -Original Message- From: Donald Organ >>> Sent: Monday, May 14, 2012 2:38 PM >>> To: solr-user@lucene.apache.org >>> Subject: Re: Boosting on field empty or not >>> >>> OK maybe i need to describe this a little more. >>> >>> Basically I want documents that have a given field populated to have a >>> higher score than the documents that dont. So if you search for foo I >>> want >>> documents that contain foo, but i want the documents that have field a >>> populated to have a higher score... >>> >>> Is there a way to do this? >>> >>> >>> >>> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky >> >* >>> *wrote: >>> >>> In a query or filter query you can write +field:* to require that a >>> field >>> >>> be populated or +(-field:*) to require that it not be populated >>>> >>>> -- Jack Krupansky >>>> >>>> -Original Message- From: Donald Organ >>>> Sent: Monday, May 14, 2012 2:10 PM >>>> To: solr-user >>>> Subject: Boosting on field empty or not >>>> >>>> Is there a way to boost a document based on whether the field is empty >>>> or >>>> not. I am looking to boost documents that have a specific field >>>> populated. >>>> >>>> >>>> >>>> >>> >> >
Re: Boosting on field empty or not
OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: > OK i must be missing something: > > > defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 > codeTXT^2 description^1 brand_search^0 > cat_search^10&spellcheck=true&spellcheck.collate=true&spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs > AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc > > > On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky > wrote: > >> "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the >> missing boost operator. >> >> -- Jack Krupansky >> >> -Original Message----- From: Donald Organ >> Sent: Monday, May 14, 2012 3:31 PM >> To: solr-user@lucene.apache.org >> Subject: Re: Boosting on field empty or not >> >> Still doesnt appear to be working. Here is the full Query string: >> >> >> defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 >> codeTXT^2 description^1 brand_search^0 >> cat_search^10&spellcheck=true&**spellcheck.collate=true&** >> spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs >> AND (regularprice:*^5 OR (*:* -regularprice:*)5) >> >> >> On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky >> **wrote: >> >> Sorry, make that: >>> >>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >>> >>> I forgot that pure negative queries are broken again, so you need the *:* >>> in there. >>> >>> I noticed that you second boost operator was missing as well. >>> >>> -- Jack Krupansky >>> >>> -Original Message- From: Donald Organ >>> Sent: Monday, May 14, 2012 3:24 PM >>> To: solr-user@lucene.apache.org >>> Subject: Re: Boosting on field empty or not >>> >>> OK i just tried: >>> >>> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >>> >>> >>> And that gives me 0 results >>> >>> >>> On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky >> >* >>> *wrote: >>> >>> foo AND (field:*^2.0 OR (-field:*)^0.5) >>> >>>> >>>> So, if a doc has anything in the field, it gets boosted, and if the doc >>>> does not have anything in the field, de-boost it. Choose the boost >>>> factors >>>> to suit your desired boosting effect. >>>> >>>> -- Jack Krupansky >>>> >>>> -Original Message- From: Donald Organ >>>> Sent: Monday, May 14, 2012 2:38 PM >>>> To: solr-user@lucene.apache.org >>>> Subject: Re: Boosting on field empty or not >>>> >>>> OK maybe i need to describe this a little more. >>>> >>>> Basically I want documents that have a given field populated to have a >>>> higher score than the documents that dont. So if you search for foo I >>>> want >>>> documents that contain foo, but i want the documents that have field a >>>> populated to have a higher score... >>>> >>>> Is there a way to do this? >>>> >>>> >>>> >>>> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < >>>> j...@basetechnology.com >>>> >* >>>> *wrote: >>>> >>>> In a query or filter query you can write +field:* to require that a >>>> field >>>> >>>> be populated or +(-field:*) to require that it not be populated >>>>> >>>>> -- Jack Krupansky >>>>> >>>>> -Original Message- From: Donald Organ >>>>> Sent: Monday, May 14, 2012 2:10 PM >>>>> To: solr-user >>>>> Subject: Boosting on field empty or not >>>>> >>>>> Is there a way to boost a document based on whether the field is empty >>>>> or >>>>> not. I am looking to boost documents that have a specific field >>>>> populated. >>>>> >>>>> >>>>> >>>>> >>>> >>> >> >
Re: Boosting on field empty or not
Change the second boost to 0.5 to de-boost doc that are missing the field value. You had them the same. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:01 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: OK i must be missing something: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky wrote: "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&**spellcheck.collate=true&** spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky **wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky * *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message----- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -----Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc Same effect. On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky wrote: > Change the second boost to 0.5 to de-boost doc that are missing the field > value. You had them the same. > > -- Jack Krupansky > > -Original Message- From: Donald Organ > Sent: Monday, May 14, 2012 4:01 PM > To: solr-user@lucene.apache.org > Subject: Re: Boosting on field empty or not > > OK it looks like the query change is working but it looks like it boosting > everything even documents that have that field empty > > On Mon, May 14, 2012 at 3:41 PM, Donald Organ >wrote: > > OK i must be missing something: >> >> >> defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 >> codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&** >> spellcheck.collate=true&**spellcheck.q=chairs&facet.** >> mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* >> -regularprice:*)^5)&sort=score desc >> >> >> On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky >> **wrote: >> >> "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the >>> missing boost operator. >>> >>> -- Jack Krupansky >>> >>> -Original Message- From: Donald Organ >>> Sent: Monday, May 14, 2012 3:31 PM >>> To: solr-user@lucene.apache.org >>> Subject: Re: Boosting on field empty or not >>> >>> Still doesnt appear to be working. Here is the full Query string: >>> >>> >>> defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 >>> name^10 >>> codeTXT^2 description^1 brand_search^0 >>> cat_search^10&spellcheck=true&spellcheck.collate=true&** >>> spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs >>> AND (regularprice:*^5 OR (*:* -regularprice:*)5) >>> >>> >>> On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky >> > >>> **wrote: >>> >>> Sorry, make that: >>> >>>> >>>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >>>> >>>> I forgot that pure negative queries are broken again, so you need the >>>> *:* >>>> in there. >>>> >>>> I noticed that you second boost operator was missing as well. >>>> >>>> -- Jack Krupansky >>>> >>>> -Original Message- From: Donald Organ >>>> Sent: Monday, May 14, 2012 3:24 PM >>>> To: solr-user@lucene.apache.org >>>> Subject: Re: Boosting on field empty or not >>>> >>>> OK i just tried: >>>> >>>> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >>>> >>>> >>>> And that gives me 0 results >>>> >>>> >>>> On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < >>>> j...@basetechnology.com >>>> >* >>>> *wrote: >>>> >>>> foo AND (field:*^2.0 OR (-field:*)^0.5) >>>> >>>> >>>>> So, if a doc has anything in the field, it gets boosted, and if the doc >>>>> does not have anything in the field, de-boost it. Choose the boost >>>>> factors >>>>> to suit your desired boosting effect. >>>>> >>>>> -- Jack Krupansky >>>>> >>>>> -Original Message- From: Donald Organ >>>>> Sent: Monday, May 14, 2012 2:38 PM >>>>> To: solr-user@lucene.apache.org >>>>> Subject: Re: Boosting on field empty or not >>>>> >>>>> OK maybe i need to describe this a little more. >>>>> >>>>> Basically I want documents that have a given field populated to have a >>>>> higher score than the documents that dont. So if you search for foo I >>>>> want >>>>> documents that contain foo, but i want the documents that have field a >>>>> populated to have a higher score... >>>>> >>>>> Is there a way to do this? >>>>> >>>>> >>>>> >>>>> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < >>>>> j...@basetechnology.com >>>>> >* >>>>> *wrote: >>>>> >>>>> In a query or filter query you can write +field:* to require that a >>>>> field >>>>> >>>>> be populated or +(-field:*) to require that it not be populated >>>>> >>>>>> >>>>>> -- Jack Krupansky >>>>>> >>>>>> -Original Message- From: Donald Organ >>>>>> Sent: Monday, May 14, 2012 2:10 PM >>>>>> To: solr-user >>>>>> Subject: Boosting on field empty or not >>>>>> >>>>>> Is there a way to boost a document based on whether the field is empty >>>>>> or >>>>>> not. I am looking to boost documents that have a specific field >>>>>> populated. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> >
Re: Boosting on field empty or not
I've even tried upping the boost to 10 and the de-boost to 1but yet its still applying the boost to all the documents returned. So it matter if this is a money field? On Mon, May 14, 2012 at 4:19 PM, Donald Organ wrote: > &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc > > > Same effect. > > > On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky > wrote: > >> Change the second boost to 0.5 to de-boost doc that are missing the field >> value. You had them the same. >> >> -- Jack Krupansky >> >> -Original Message- From: Donald Organ >> Sent: Monday, May 14, 2012 4:01 PM >> To: solr-user@lucene.apache.org >> Subject: Re: Boosting on field empty or not >> >> OK it looks like the query change is working but it looks like it boosting >> everything even documents that have that field empty >> >> On Mon, May 14, 2012 at 3:41 PM, Donald Organ > >wrote: >> >> OK i must be missing something: >>> >>> >>> defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 >>> name^10 codeTXT^2 description^1 brand_search^0 >>> cat_search^10&spellcheck=true&**spellcheck.collate=true&** >>> spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs AND >>> (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc >>> >>> >>> On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky >> >**wrote: >>> >>> "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the >>>> missing boost operator. >>>> >>>> -- Jack Krupansky >>>> >>>> -Original Message- From: Donald Organ >>>> Sent: Monday, May 14, 2012 3:31 PM >>>> To: solr-user@lucene.apache.org >>>> Subject: Re: Boosting on field empty or not >>>> >>>> Still doesnt appear to be working. Here is the full Query string: >>>> >>>> >>>> defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 >>>> name^10 >>>> codeTXT^2 description^1 brand_search^0 >>>> cat_search^10&spellcheck=true&spellcheck.collate=true&** >>>> spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs >>>> AND (regularprice:*^5 OR (*:* -regularprice:*)5) >>>> >>>> >>>> On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky < >>>> j...@basetechnology.com> >>>> **wrote: >>>> >>>> Sorry, make that: >>>> >>>>> >>>>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >>>>> >>>>> I forgot that pure negative queries are broken again, so you need the >>>>> *:* >>>>> in there. >>>>> >>>>> I noticed that you second boost operator was missing as well. >>>>> >>>>> -- Jack Krupansky >>>>> >>>>> -Original Message- From: Donald Organ >>>>> Sent: Monday, May 14, 2012 3:24 PM >>>>> To: solr-user@lucene.apache.org >>>>> Subject: Re: Boosting on field empty or not >>>>> >>>>> OK i just tried: >>>>> >>>>> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >>>>> >>>>> >>>>> And that gives me 0 results >>>>> >>>>> >>>>> On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < >>>>> j...@basetechnology.com >>>>> >* >>>>> *wrote: >>>>> >>>>> foo AND (field:*^2.0 OR (-field:*)^0.5) >>>>> >>>>> >>>>>> So, if a doc has anything in the field, it gets boosted, and if the >>>>>> doc >>>>>> does not have anything in the field, de-boost it. Choose the boost >>>>>> factors >>>>>> to suit your desired boosting effect. >>>>>> >>>>>> -- Jack Krupansky >>>>>> >>>>>> -Original Message- From: Donald Organ >>>>>> Sent: Monday, May 14, 2012 2:38 PM >>>>>> To: solr-user@lucene.apache.org >>>>>> Subject: Re: Boosting on field empty or not >>>>>> >>>>>> OK maybe i need to describe this a little more. >>>>>> >>>>>> Basically I want documents that have a given field populated to have a >>>>>> higher score than the documents that dont. So if you search for foo I >>>>>> want >>>>>> documents that contain foo, but i want the documents that have field a >>>>>> populated to have a higher score... >>>>>> >>>>>> Is there a way to do this? >>>>>> >>>>>> >>>>>> >>>>>> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < >>>>>> j...@basetechnology.com >>>>>> >* >>>>>> *wrote: >>>>>> >>>>>> In a query or filter query you can write +field:* to require that a >>>>>> field >>>>>> >>>>>> be populated or +(-field:*) to require that it not be populated >>>>>> >>>>>>> >>>>>>> -- Jack Krupansky >>>>>>> >>>>>>> -Original Message- From: Donald Organ >>>>>>> Sent: Monday, May 14, 2012 2:10 PM >>>>>>> To: solr-user >>>>>>> Subject: Boosting on field empty or not >>>>>>> >>>>>>> Is there a way to boost a document based on whether the field is >>>>>>> empty >>>>>>> or >>>>>>> not. I am looking to boost documents that have a specific field >>>>>>> populated. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
Re: Boosting on field empty or not
OK i think i found the proper way to do what i was trying to do: &q=chairs AND (regularprice:[0 TO *]^5) On Mon, May 14, 2012 at 4:25 PM, Donald Organ wrote: > I've even tried upping the boost to 10 and the de-boost to 1but yet > its still applying the boost to all the documents returned. So it matter > if this is a money field? > > On Mon, May 14, 2012 at 4:19 PM, Donald Organ wrote: > >> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc >> >> >> Same effect. >> >> >> On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky >> wrote: >> >>> Change the second boost to 0.5 to de-boost doc that are missing the >>> field value. You had them the same. >>> >>> -- Jack Krupansky >>> >>> -----Original Message----- From: Donald Organ >>> Sent: Monday, May 14, 2012 4:01 PM >>> To: solr-user@lucene.apache.org >>> Subject: Re: Boosting on field empty or not >>> >>> OK it looks like the query change is working but it looks like it >>> boosting >>> everything even documents that have that field empty >>> >>> On Mon, May 14, 2012 at 3:41 PM, Donald Organ >> >wrote: >>> >>> OK i must be missing something: >>>> >>>> >>>> defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 >>>> name^10 codeTXT^2 description^1 brand_search^0 >>>> cat_search^10&spellcheck=true&**spellcheck.collate=true&** >>>> spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs AND >>>> (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc >>>> >>>> >>>> On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky < >>>> j...@basetechnology.com>**wrote: >>>> >>>> "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the >>>>> missing boost operator. >>>>> >>>>> -- Jack Krupansky >>>>> >>>>> -Original Message- From: Donald Organ >>>>> Sent: Monday, May 14, 2012 3:31 PM >>>>> To: solr-user@lucene.apache.org >>>>> Subject: Re: Boosting on field empty or not >>>>> >>>>> Still doesnt appear to be working. Here is the full Query string: >>>>> >>>>> >>>>> defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 >>>>> name^10 >>>>> codeTXT^2 description^1 brand_search^0 >>>>> cat_search^10&spellcheck=true&spellcheck.collate=true&** >>>>> spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs >>>>> AND (regularprice:*^5 OR (*:* -regularprice:*)5) >>>>> >>>>> >>>>> On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky < >>>>> j...@basetechnology.com> >>>>> **wrote: >>>>> >>>>> Sorry, make that: >>>>> >>>>>> >>>>>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >>>>>> >>>>>> I forgot that pure negative queries are broken again, so you need the >>>>>> *:* >>>>>> in there. >>>>>> >>>>>> I noticed that you second boost operator was missing as well. >>>>>> >>>>>> -- Jack Krupansky >>>>>> >>>>>> -Original Message- From: Donald Organ >>>>>> Sent: Monday, May 14, 2012 3:24 PM >>>>>> To: solr-user@lucene.apache.org >>>>>> Subject: Re: Boosting on field empty or not >>>>>> >>>>>> OK i just tried: >>>>>> >>>>>> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >>>>>> >>>>>> >>>>>> And that gives me 0 results >>>>>> >>>>>> >>>>>> On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < >>>>>> j...@basetechnology.com >>>>>> >* >>>>>> *wrote: >>>>>> >>>>>> foo AND (field:*^2.0 OR (-field:*)^0.5) >>>>>> >>>>>> >>>>>>> So, if a doc has anything in the field, it gets boosted, and if the >>>>>>> doc >>>>>>> does not have anything in the field, de-boost it. Choose the boost >>>>>>> factors >>>>>>> to suit your desired boosting effect. >>>>>>> >>>>>>> -- Jack Krupansky >>>>>>> >>>>>>> -Original Message- From: Donald Organ >>>>>>> Sent: Monday, May 14, 2012 2:38 PM >>>>>>> To: solr-user@lucene.apache.org >>>>>>> Subject: Re: Boosting on field empty or not >>>>>>> >>>>>>> OK maybe i need to describe this a little more. >>>>>>> >>>>>>> Basically I want documents that have a given field populated to have >>>>>>> a >>>>>>> higher score than the documents that dont. So if you search for foo >>>>>>> I >>>>>>> want >>>>>>> documents that contain foo, but i want the documents that have field >>>>>>> a >>>>>>> populated to have a higher score... >>>>>>> >>>>>>> Is there a way to do this? >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < >>>>>>> j...@basetechnology.com >>>>>>> >* >>>>>>> *wrote: >>>>>>> >>>>>>> In a query or filter query you can write +field:* to require that a >>>>>>> field >>>>>>> >>>>>>> be populated or +(-field:*) to require that it not be populated >>>>>>> >>>>>>>> >>>>>>>> -- Jack Krupansky >>>>>>>> >>>>>>>> -Original Message- From: Donald Organ >>>>>>>> Sent: Monday, May 14, 2012 2:10 PM >>>>>>>> To: solr-user >>>>>>>> Subject: Boosting on field empty or not >>>>>>>> >>>>>>>> Is there a way to boost a document based on whether the field is >>>>>>>> empty >>>>>>>> or >>>>>>>> not. I am looking to boost documents that have a specific field >>>>>>>> populated. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
Re: Boosting on field empty or not
OK thats giving me only documents that have the field populated On Mon, May 14, 2012 at 4:28 PM, Donald Organ wrote: > OK i think i found the proper way to do what i was trying to do: > > &q=chairs AND (regularprice:[0 TO *]^5) > > > On Mon, May 14, 2012 at 4:25 PM, Donald Organ wrote: > >> I've even tried upping the boost to 10 and the de-boost to 1but yet >> its still applying the boost to all the documents returned. So it matter >> if this is a money field? >> >> On Mon, May 14, 2012 at 4:19 PM, Donald Organ wrote: >> >>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score >>> desc >>> >>> >>> Same effect. >>> >>> >>> On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky >> > wrote: >>> >>>> Change the second boost to 0.5 to de-boost doc that are missing the >>>> field value. You had them the same. >>>> >>>> -- Jack Krupansky >>>> >>>> -Original Message- From: Donald Organ >>>> Sent: Monday, May 14, 2012 4:01 PM >>>> To: solr-user@lucene.apache.org >>>> Subject: Re: Boosting on field empty or not >>>> >>>> OK it looks like the query change is working but it looks like it >>>> boosting >>>> everything even documents that have that field empty >>>> >>>> On Mon, May 14, 2012 at 3:41 PM, Donald Organ >>> >wrote: >>>> >>>> OK i must be missing something: >>>>> >>>>> >>>>> defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 >>>>> name^10 codeTXT^2 description^1 brand_search^0 >>>>> cat_search^10&spellcheck=true&**spellcheck.collate=true&** >>>>> spellcheck.q=chairs&facet.**mincount=1&fl=code,score&q=**chairs AND >>>>> (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc >>>>> >>>>> >>>>> On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky < >>>>> j...@basetechnology.com>**wrote: >>>>> >>>>> "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the >>>>>> missing boost operator. >>>>>> >>>>>> -- Jack Krupansky >>>>>> >>>>>> -Original Message- From: Donald Organ >>>>>> Sent: Monday, May 14, 2012 3:31 PM >>>>>> To: solr-user@lucene.apache.org >>>>>> Subject: Re: Boosting on field empty or not >>>>>> >>>>>> Still doesnt appear to be working. Here is the full Query string: >>>>>> >>>>>> >>>>>> defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^****10 >>>>>> name^10 >>>>>> codeTXT^2 description^1 brand_search^0 >>>>>> cat_search^10&spellcheck=true&spellcheck.collate=true&** >>>>>> spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs >>>>>> AND (regularprice:*^5 OR (*:* -regularprice:*)5) >>>>>> >>>>>> >>>>>> On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky < >>>>>> j...@basetechnology.com> >>>>>> **wrote: >>>>>> >>>>>> Sorry, make that: >>>>>> >>>>>>> >>>>>>> &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) >>>>>>> >>>>>>> I forgot that pure negative queries are broken again, so you need >>>>>>> the *:* >>>>>>> in there. >>>>>>> >>>>>>> I noticed that you second boost operator was missing as well. >>>>>>> >>>>>>> -- Jack Krupansky >>>>>>> >>>>>>> -Original Message- From: Donald Organ >>>>>>> Sent: Monday, May 14, 2012 3:24 PM >>>>>>> To: solr-user@lucene.apache.org >>>>>>> Subject: Re: Boosting on field empty or not >>>>>>> >>>>>>> OK i just tried: >>>>>>> >>>>>>> &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) >>>>>>> >>>>>>> >>>>>>> And that gives me 0 results >>>>>>
Re: Boosting on field empty or not
It may not matter, but the spaces in the query should be uuencoded as "+". I have the query working with Solr query, but it is giving me no docs for edismax for some reason. But, it does seem to work if I reverse the order of the query terms to be: http://localhost:8983/solr/select/?q=*:*+AND+((*:*+-price:*)^0.5+OR+price:*^5)&defType=edismax&debugQuery=true&qf=text Let me try a couple more things. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:19 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc Same effect. On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky wrote: Change the second boost to 0.5 to de-boost doc that are missing the field value. You had them the same. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:01 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: OK i must be missing something: defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&** spellcheck.collate=true&**spellcheck.q=chairs&facet.** mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky **wrote: "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&** spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky **wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -----Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
Oh well, it looks like my suggestion is running into "SOLR-3377 - eDismax: A fielded query wrapped by parens is not recognized". See: https://issues.apache.org/jira/browse/SOLR-3377 That issue has a patch, but not yet committed. That explains why it works in the traditional Solr/Lucene query parser, but not in edismax. http://localhost:8983/solr/select/?q=the+AND+(price:*^5+OR+(*:*+-price:*)^0.5) -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Monday, May 14, 2012 4:49 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not It may not matter, but the spaces in the query should be uuencoded as "+". I have the query working with Solr query, but it is giving me no docs for edismax for some reason. But, it does seem to work if I reverse the order of the query terms to be: http://localhost:8983/solr/select/?q=*:*+AND+((*:*+-price:*)^0.5+OR+price:*^5)&defType=edismax&debugQuery=true&qf=text Let me try a couple more things. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:19 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc Same effect. On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky wrote: Change the second boost to 0.5 to de-boost doc that are missing the field value. You had them the same. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:01 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: OK i must be missing something: defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&** spellcheck.collate=true&**spellcheck.q=chairs&facet.** mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky **wrote: "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&** spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky **wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -----Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
Reading more closely, I see that there is a workaround: add a space after any left parenthesis. So, try this: q=chairs+AND+(+regularprice:*^5+OR+(+*:*+-regularprice:*)^5) Here's an example of my own: http://localhost:8983/solr/select/?q=the+AND+(+price:*^5+OR+(+*:*+-price:*)^0.5)&defType=edismax&debugQuery=true&qf=text -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Monday, May 14, 2012 7:21 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Oh well, it looks like my suggestion is running into "SOLR-3377 - eDismax: A fielded query wrapped by parens is not recognized". See: https://issues.apache.org/jira/browse/SOLR-3377 That issue has a patch, but not yet committed. That explains why it works in the traditional Solr/Lucene query parser, but not in edismax. http://localhost:8983/solr/select/?q=the+AND+(price:*^5+OR+(*:*+-price:*)^0.5) -- Jack Krupansky -Original Message- From: Jack Krupansky Sent: Monday, May 14, 2012 4:49 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not It may not matter, but the spaces in the query should be uuencoded as "+". I have the query working with Solr query, but it is giving me no docs for edismax for some reason. But, it does seem to work if I reverse the order of the query terms to be: http://localhost:8983/solr/select/?q=*:*+AND+((*:*+-price:*)^0.5+OR+price:*^5)&defType=edismax&debugQuery=true&qf=text Let me try a couple more things. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:19 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc Same effect. On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky wrote: Change the second boost to 0.5 to de-boost doc that are missing the field value. You had them the same. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:01 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: OK i must be missing something: defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&** spellcheck.collate=true&**spellcheck.q=chairs&facet.** mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky **wrote: "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message----- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&** spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky **wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < j...@basetechnology
Re: Boosting on field empty or not
> Basically I want documents that have a given field populated > to have a > higher score than the documents that dont. So if you > search for foo I want > documents that contain foo, but i want the documents that > have field a > populated to have a higher score... Hi Donald, Since you are using edismax, it is better to use bq (boosting query) for this. bq=reqularprice:[* TO *]^50 http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29 defType=edismax&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&q=chairs&bq=reqularprice:[* TO *]^50
Re: Boosting on field empty or not
The problem with what you provided is it is boosting ALL documents whether the field is empty or not On Tue, May 15, 2012 at 3:52 AM, Ahmet Arslan wrote: > > Basically I want documents that have a given field populated > > to have a > > higher score than the documents that dont. So if you > > search for foo I want > > documents that contain foo, but i want the documents that > > have field a > > populated to have a higher score... > > > Hi Donald, > > Since you are using edismax, it is better to use bq (boosting query) for > this. > > bq=reqularprice:[* TO *]^50 > > http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29 > > defType=edismax&qf=nameSuggest^10 name^10 codeTXT^2 description^1 > brand_search^0 cat_search^10&q=chairs&bq=reqularprice:[* TO *]^50 > >
Re: Boosting on field empty or not
> The problem with what you provided is > it is boosting ALL documents whether > the field is empty or not Then all of your fields are non-empty? What is the type of your field?
Re: Boosting on field empty or not
> > The problem with what you > provided is > > it is boosting ALL documents whether > > the field is empty or not > > Then all of your fields are non-empty? What is the type of > your field? How do you feed your documents to solr? My be you are indexing empty string? Is your field indexed="true"? http://wiki.apache.org/solr/SolrQuerySyntax#Differences_From_Lucene_Query_Parser "-field:[* TO *] finds all documents without a value for field" Another approach is to use default="SOMETHING" in your field definition. (schema.xml) Then you can use field:SOMETHING to retrieve empty fields. +*:* -field:SOMETHING retrieves non-empty documents.
Re: Boosting on field empty or not
Let's go back to this step where things look correct, but we ran into the edismax bug which requires that you put a space between each left parenthesis and field name. First, verify that you are using edismax or not. Then, change: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc to &q=chairs AND ( regularprice:*^5 OR ( *:* -regularprice:*)^0.5)&sort=score desc (Note the space after each "(".) And make sure to uuencode your spaces as "+" or "%20". Also, try this to verify whether you really have chairs without prices: &q=chairs AND ( *:* -regularprice:*)&sort=score desc (Note that space after "(".) And for sanity, try this as well: &q=chairs AND ( -regularprice:*)&sort=score desc (Again, note that space after "(".) Those two queries should give identical results. Finally, technically you should be able to use "*" or "[* TO *]" to match all values or negate them to match all documents without a value in a field, but try both to see that they do return the identical set of documents. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 4:19 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5)&sort=score desc Same effect. On Mon, May 14, 2012 at 4:12 PM, Jack Krupansky wrote: Change the second boost to 0.5 to de-boost doc that are missing the field value. You had them the same. -- Jack Krupansky -Original Message----- From: Donald Organ Sent: Monday, May 14, 2012 4:01 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK it looks like the query change is working but it looks like it boosting everything even documents that have that field empty On Mon, May 14, 2012 at 3:41 PM, Donald Organ wrote: OK i must be missing something: defType=edismax&start=0&rows=**24&facet=true&qf=nameSuggest^**10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&** spellcheck.collate=true&**spellcheck.q=chairs&facet.** mincount=1&fl=code,score&q=**chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^5)&sort=score desc On Mon, May 14, 2012 at 3:36 PM, Jack Krupansky **wrote: "(*:* -regularprice:*)5" should be "(*:* -regularprice:*)^0.5" - the missing boost operator. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:31 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not Still doesnt appear to be working. Here is the full Query string: defType=edismax&start=0&rows=24&facet=true&qf=nameSuggest^10 name^10 codeTXT^2 description^1 brand_search^0 cat_search^10&spellcheck=true&spellcheck.collate=true&** spellcheck.q=chairs&facet.mincount=1&fl=code,score&q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)5) On Mon, May 14, 2012 at 3:28 PM, Jack Krupansky **wrote: Sorry, make that: &q=chairs AND (regularprice:*^5 OR (*:* -regularprice:*)^0.5) I forgot that pure negative queries are broken again, so you need the *:* in there. I noticed that you second boost operator was missing as well. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 3:24 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK i just tried: &q=chairs AND (regularprice:*^5 OR (-regularprice:*)5) And that gives me 0 results On Mon, May 14, 2012 at 2:51 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: foo AND (field:*^2.0 OR (-field:*)^0.5) So, if a doc has anything in the field, it gets boosted, and if the doc does not have anything in the field, de-boost it. Choose the boost factors to suit your desired boosting effect. -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:38 PM To: solr-user@lucene.apache.org Subject: Re: Boosting on field empty or not OK maybe i need to describe this a little more. Basically I want documents that have a given field populated to have a higher score than the documents that dont. So if you search for foo I want documents that contain foo, but i want the documents that have field a populated to have a higher score... Is there a way to do this? On Mon, May 14, 2012 at 2:22 PM, Jack Krupansky < j...@basetechnology.com >* *wrote: In a query or filter query you can write +field:* to require that a field be populated or +(-field:*) to require that it not be populated -- Jack Krupansky -Original Message- From: Donald Organ Sent: Monday, May 14, 2012 2:10 PM To: solr-user Subject: Boosting on field empty or not Is there a way to boost a document based on whether the field is empty or not. I am looking to boost documents that have a specific field populated.
Re: Boosting on field empty or not
I have figured it out using your recommendation...I just had to give it a high enough boost. BTW its a float field On Tue, May 15, 2012 at 9:21 AM, Ahmet Arslan wrote: > > The problem with what you provided is > > it is boosting ALL documents whether > > the field is empty or not > > Then all of your fields are non-empty? What is the type of your field? > >
Re: Boosting on field empty or not
Scratch that...it still seems to be boosting documents where the value of the field is empty. bq=regularprice:[0.01 TO *]^50 Results with bq set: 2.2172112 bhl-ltab-30 Results without bq set: 2.4847748 bhl-ltab-30 On Tue, May 15, 2012 at 12:40 PM, Donald Organ wrote: > I have figured it out using your recommendation...I just had to give it a > high enough boost. > > BTW its a float field > > On Tue, May 15, 2012 at 9:21 AM, Ahmet Arslan wrote: > >> > The problem with what you provided is >> > it is boosting ALL documents whether >> > the field is empty or not >> >> Then all of your fields are non-empty? What is the type of your field? >> >> >
Re: Boosting on field empty or not
> Scratch that...it still seems to be > boosting documents where the value of > the field is empty. > > > bq=regularprice:[0.01 TO *]^50 > > Results with bq set: > > > name="score">2.2172112 > name="code">bhl-ltab-30 > > > > Results without bq set: > > > name="score">2.4847748 > name="code">bhl-ltab-30 > > Important thing is the order. Does the order of results change in a way that you want? (When you add bq) It is not a good idea to compare scores of two different queries. I *think* queryNorm is causing this difference. You can add debugQuery=on and see what is the difference.
Re: Boosting on field empty or not
If the bq is only supposed apply the boost when the field value is greater than 0.01 why would trying another query make sure this is working. Its applying the boost to all the fields, yes when the boost is high enough most of documents with a value GT 0.01 show up first however since it is applying the boost to all the documents sometimes documents without a value in this field appear before those that do. On Tue, May 15, 2012 at 4:51 PM, Ahmet Arslan wrote: > > Scratch that...it still seems to be > > boosting documents where the value of > > the field is empty. > > > > > > bq=regularprice:[0.01 TO *]^50 > > > > Results with bq set: > > > > > > > name="score">2.2172112 > > > name="code">bhl-ltab-30 > > > > > > > > Results without bq set: > > > > > > > name="score">2.4847748 > > > name="code">bhl-ltab-30 > > > > > > Important thing is the order. Does the order of results change in a way > that you want? (When you add bq) > > It is not a good idea to compare scores of two different queries. I > *think* queryNorm is causing this difference. > You can add debugQuery=on and see what is the difference. > >
Re: Boosting on field empty or not
> If the bq is only supposed apply the > boost when the field value is greater > than 0.01 why would trying another query make sure this is > working. > > Its applying the boost to all the fields, yes when the boost > is high enough > most of documents with a value GT 0.01 show up first however > since it is > applying the boost to all the documents sometimes documents > without a value > in this field appear before those that do. If boosting is applied to all documents, then why result order is changing? Sometimes documents without a value can show-up before because there are other factors that contribute score calculation. http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html If you add &debugQuery=on, you can see detailed explanation about how calculation is done.
Re: Boosting on field empty or not
Just tested to make sure. queryNorm is changing after you add bq parameter. For example : 0.00317763 = queryNorm becomes 0.0028020076 = queryNorm. Since all scores are multiplied by this queryNorm factor, score of a document ( even if it is not effected/boosted by bq) changes. before &bq=SOURCE:Haberler^100 5.246903 4529806 EnSonHaber after &bq=SOURCE:Haberler^100 4.626675 4529806 EnSonHaber Does that makes sense? > > If the bq is only supposed apply the > > boost when the field value is greater > > than 0.01 why would trying another query make sure this > is > > working. > > > > Its applying the boost to all the fields, yes when the > boost > > is high enough > > most of documents with a value GT 0.01 show up first > however > > since it is > > applying the boost to all the documents sometimes > documents > > without a value > > in this field appear before those that do. > > If boosting is applied to all documents, then why result > order is changing? > > Sometimes documents without a value can show-up before > because there are other factors that contribute score > calculation. > > http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html > > If you add &debugQuery=on, you can see detailed > explanation about how calculation is done. >