Softer version of grouping and/or filter query

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Softer version of grouping and/or filter query

Doug Reeder
We have a query to return products related to a given product. To give some
variety to the results, we group by vendor:
group=true&group.main=true&group.field=merchantId

We need at least four results to display. Unfortunately, some categories
don't have a lot of products, and grouping takes us (say) from five results
to three.

Can I "soften" the grouping, so other products by the same vendor will
appear in the results, but with much lower score?


Similarly, we have a filter query that only returns products over $150:
fq=price:[150+TO+*]

Can this be changed to a q or qf parameter where products less than $150
have score less than any product priced $150 or more? (A price higher than
$150 should not increase the score.)
Reply | Threaded
Open this post in threaded view
|

Re: Softer version of grouping and/or filter query

Emir Arnautović
Hi Doug,
It seems to me that you’ve found a way to increase score for those that are within selected price range, but “A price higher than $150 should not increase the score”. I’ll just remind you that scores in Solr are relevant to query and that you cannot do much other than sorting on it so it should not matter much if you boost the one that you like more or decrease score for those that are not your first choice.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 8 May 2019, at 23:56, Doug Reeder <[hidden email]> wrote:
>
> We have a query to return products related to a given product. To give some
> variety to the results, we group by vendor:
> group=true&group.main=true&group.field=merchantId
>
> We need at least four results to display. Unfortunately, some categories
> don't have a lot of products, and grouping takes us (say) from five results
> to three.
>
> Can I "soften" the grouping, so other products by the same vendor will
> appear in the results, but with much lower score?
>
>
> Similarly, we have a filter query that only returns products over $150:
> fq=price:[150+TO+*]
>
> Can this be changed to a q or qf parameter where products less than $150
> have score less than any product priced $150 or more? (A price higher than
> $150 should not increase the score.)

Reply | Threaded
Open this post in threaded view
|

Re: Softer version of grouping and/or filter query

Edward Ribeiro
In reply to this post by Doug Reeder
Em qua, 8 de mai de 2019 18:56, Doug Reeder <[hidden email]>
escreveu:

>
> Similarly, we have a filter query that only returns products over $150:
> fq=price:[150+TO+*]
>
> Can this be changed to a q or qf parameter where products less than $150
> have score less than any product priced $150 or more? (A price higher than
> $150 should not increase the score.)
>

If you are using edismax then you could use boost function. Maybe something
along those: bf=if(lt(price, 150), 0.5, 100)

Your fq already filters out documents with prices less than 150. Using a
boost (function/query) will retrieve back docs with prices less than 150,
but probably with smaller scores.

Edward

>
Reply | Threaded
Open this post in threaded view
|

Re: Softer version of grouping and/or filter query

Doug Reeder
Thanks much!  I dropped price from the fq term, changed to an edismax
parser, and boosted with
bq=price:[150+TO+*]^100



On Thu, May 9, 2019 at 7:21 AM Edward Ribeiro <[hidden email]>
wrote:

> Em qua, 8 de mai de 2019 18:56, Doug Reeder <[hidden email]>
> escreveu:
>
> >
> > Similarly, we have a filter query that only returns products over $150:
> > fq=price:[150+TO+*]
> >
> > Can this be changed to a q or qf parameter where products less than $150
> > have score less than any product priced $150 or more? (A price higher
> than
> > $150 should not increase the score.)
> >
>
> If you are using edismax then you could use boost function. Maybe something
> along those: bf=if(lt(price, 150), 0.5, 100)
>
> Your fq already filters out documents with prices less than 150. Using a
> boost (function/query) will retrieve back docs with prices less than 150,
> but probably with smaller scores.
>
> Edward
>
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Softer version of grouping and/or filter query

Edward Ribeiro
Cool! Paraphrasing 'Solr in Action' book: edismax is the query parser to
use when dealing with users' queries. It has a lot of customization options
and is more resilient to ill-formed queries than lucene-parser. Whenever
possible, take some time to dig deeper into those. :)

Regards,
Edward

On Fri, May 10, 2019 at 6:09 PM Doug Reeder <[hidden email]> wrote:

> Thanks much!  I dropped price from the fq term, changed to an edismax
> parser, and boosted with
> bq=price:[150+TO+*]^100
>
>
>
> On Thu, May 9, 2019 at 7:21 AM Edward Ribeiro <[hidden email]>
> wrote:
>
> > Em qua, 8 de mai de 2019 18:56, Doug Reeder <[hidden email]>
> > escreveu:
> >
> > >
> > > Similarly, we have a filter query that only returns products over $150:
> > > fq=price:[150+TO+*]
> > >
> > > Can this be changed to a q or qf parameter where products less than
> $150
> > > have score less than any product priced $150 or more? (A price higher
> > than
> > > $150 should not increase the score.)
> > >
> >
> > If you are using edismax then you could use boost function. Maybe
> something
> > along those: bf=if(lt(price, 150), 0.5, 100)
> >
> > Your fq already filters out documents with prices less than 150. Using a
> > boost (function/query) will retrieve back docs with prices less than 150,
> > but probably with smaller scores.
> >
> > Edward
> >
> > >
> >
>