Re: Re: SolR: How to sort (or boost) by Availability dates
Yay! -- Audrey Lorberfeld Data Scientist, w3 Search IBM audrey.lorberf...@ibm.com On 9/24/19, 10:15 AM, "digi_business" wrote: Hi all, reading your suggestions i've juste come out of the darkness! Just for explaining, my problem is that i want to show all my items (not only the "availables"), but having the availables coming first, still mantaining my custom sorting by "ranking" desc. i then used this BoostQuery bq=(Avail_From: [* TO NOW] AND Avail_To: [NOW TO *])^10 and discovered that for activating it i must declare defType=edismax before all then i discovered about the default SolR "score" sorting, and explicitating it like this did the magic sort=score desc, Ranking desc thanks all for the help, and I really hope this could help someone else in the future -- Sent from: https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.472066.n3.nabble.com_Solr-2DUser-2Df472068.html=DwICAg=jf_iaSHvJObTbx-siA1ZOg=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M=6psFmUJgDOuMWnRpn2-SLAU20C7GLXGSvkdyOVcxe08=dOnO6vl6A2vleGcMXwtwAmYybldRdW7Cp3aerxgPeAo=
Re: SolR: How to sort (or boost) by Availability dates
Wouldn’t you reverse that? Assuming there are exactly two “available” states, sort=available desc, score desc Maybe available would sort asc, depends on your values…. > On Sep 24, 2019, at 10:15 AM, digi_business > wrote: > > Hi all, reading your suggestions i've juste come out of the darkness! > > Just for explaining, my problem is that i want to show all my items (not > only the "availables"), but having the availables coming first, still > mantaining my custom sorting by "ranking" desc. > i then used this BoostQuery > bq=(Avail_From: [* TO NOW] AND Avail_To: [NOW TO *])^10 > and discovered that for activating it i must declare defType=edismax before > all > then i discovered about the default SolR "score" sorting, and explicitating > it like this did the magic > sort=score desc, Ranking desc > > thanks all for the help, and I really hope this could help someone else in > the future > > > > -- > Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: SolR: How to sort (or boost) by Availability dates
Hi all, reading your suggestions i've juste come out of the darkness! Just for explaining, my problem is that i want to show all my items (not only the "availables"), but having the availables coming first, still mantaining my custom sorting by "ranking" desc. i then used this BoostQuery bq=(Avail_From: [* TO NOW] AND Avail_To: [NOW TO *])^10 and discovered that for activating it i must declare defType=edismax before all then i discovered about the default SolR "score" sorting, and explicitating it like this did the magic sort=score desc, Ranking desc thanks all for the help, and I really hope this could help someone else in the future -- Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: SolR: How to sort (or boost) by Availability dates
It sounds like you want to do a normal search but only show available items. You could simply just add a fq parameter with dynamic values based on the current date fq=avaiable_from:[$todays_date TO *] AND available_to[* TO $todays_date] On Tue, Sep 24, 2019 at 9:41 AM Audrey Lorberfeld - audrey.lorberf...@ibm.com wrote: > Hi Federico, > > I am not sure exactly what syntax would get you the functionality that > you're looking for, but I'd recommend writing a boost function. That's what > we're doing right now for boosting more recent results in our search > engine. You'd somehow have to work with date math and possibly make a copy > field to store the answer of the mathematical expression that would > incorporate the NOW part... > > Our boost function is > "recip(div(ms(NOW,date_discount),262800),1,24,24." It goes in the "bf" > parameter when using the edismax parser. Our function translates to "max > boost set to 1 for new docs, down to .4 after 3 years." We came up with the > time frame of the boost after creating a histogram of our corpus's > "update_date" field values (copied to the "date_discount" field) and > finding that monthly binning gave us the most normal distribution (as > opposed to weekly or yearly). > > We came up this solution after lots of surfing Solr forums and reading a > lot about date math ( > https://builds.apache.org/view/L/view/Lucene/job/Solr-reference-guide-8.x/javadoc/working-with-dates.html#date-math) > and boost functions ( > https://builds.apache.org/view/L/view/Lucene/job/Solr-reference-guide-8.x/javadoc/the-dismax-query-parser.html#bf-boost-functions-parameter). > > > Currently, we are running a grid search optimized for nDCG that runs > ~1x/week to give us the optimal a,b constants to sub out for the 24s in the > function above. We plan to change this to a linear model in the future to > cut down on the time it takes to run. > > Hopefully this gives you a nice starting place! > > Best, > Audrey > > -- > Audrey Lorberfeld > Data Scientist, w3 Search > IBM > audrey.lorberf...@ibm.com > > > On 9/24/19, 5:47 AM, "digi_business" > wrote: > > i'm facing a big problem in my SolR DB. > My objects have a datetime field "Available_From" and a datetime field > "Available_To". We also have a "Ranking" field for the sorting that we > usually use desc. > I can search correctly with direct queries (eg. give me all the items > that > are available at the moment) but when i do a regular search by other > criteria i cannot find a way to show the items that result "available > NOW" > in the first places in the specific search results, usually sorted by > "Ranking" field. > How can i do this? Am I forced to write some java classes (the nearest > thing > i've found is there > > https://urldefense.proofpoint.com/v2/url?u=https-3A__medium.com_-40devchaitu18_sorting-2Dbased-2Don-2Da-2Dcustom-2Dfunction-2Din-2Dsolr-2Dc94ddae99a12=DwICAg=jf_iaSHvJObTbx-siA1ZOg=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg=bgStMXTIXUGU1HG4dIgafvDG7gDRfLDHxqV9tiPsa_8= > ) > or is there a way to do with standard SolR queries? > Will boosting work? If yes, how can i boost by the 2 "Available_From" > and > "Available_To" fields verified at the same time, and then show the > other > results sorted by "Ranking" desc ? > Thanks in advance to everyone! > > > > -- > Sent from: > https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.472066.n3.nabble.com_Solr-2DUser-2Df472068.html=DwICAg=jf_iaSHvJObTbx-siA1ZOg=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg=uyc4rT6s7dUYCpfdc4jZseKQ7N8HAzBNof59kkyRsxg= > > >
Re: SolR: How to sort (or boost) by Availability dates
Hi Federico, I am not sure exactly what syntax would get you the functionality that you're looking for, but I'd recommend writing a boost function. That's what we're doing right now for boosting more recent results in our search engine. You'd somehow have to work with date math and possibly make a copy field to store the answer of the mathematical expression that would incorporate the NOW part... Our boost function is "recip(div(ms(NOW,date_discount),262800),1,24,24." It goes in the "bf" parameter when using the edismax parser. Our function translates to "max boost set to 1 for new docs, down to .4 after 3 years." We came up with the time frame of the boost after creating a histogram of our corpus's "update_date" field values (copied to the "date_discount" field) and finding that monthly binning gave us the most normal distribution (as opposed to weekly or yearly). We came up this solution after lots of surfing Solr forums and reading a lot about date math (https://builds.apache.org/view/L/view/Lucene/job/Solr-reference-guide-8.x/javadoc/working-with-dates.html#date-math) and boost functions (https://builds.apache.org/view/L/view/Lucene/job/Solr-reference-guide-8.x/javadoc/the-dismax-query-parser.html#bf-boost-functions-parameter). Currently, we are running a grid search optimized for nDCG that runs ~1x/week to give us the optimal a,b constants to sub out for the 24s in the function above. We plan to change this to a linear model in the future to cut down on the time it takes to run. Hopefully this gives you a nice starting place! Best, Audrey -- Audrey Lorberfeld Data Scientist, w3 Search IBM audrey.lorberf...@ibm.com On 9/24/19, 5:47 AM, "digi_business" wrote: i'm facing a big problem in my SolR DB. My objects have a datetime field "Available_From" and a datetime field "Available_To". We also have a "Ranking" field for the sorting that we usually use desc. I can search correctly with direct queries (eg. give me all the items that are available at the moment) but when i do a regular search by other criteria i cannot find a way to show the items that result "available NOW" in the first places in the specific search results, usually sorted by "Ranking" field. How can i do this? Am I forced to write some java classes (the nearest thing i've found is there https://urldefense.proofpoint.com/v2/url?u=https-3A__medium.com_-40devchaitu18_sorting-2Dbased-2Don-2Da-2Dcustom-2Dfunction-2Din-2Dsolr-2Dc94ddae99a12=DwICAg=jf_iaSHvJObTbx-siA1ZOg=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg=bgStMXTIXUGU1HG4dIgafvDG7gDRfLDHxqV9tiPsa_8= ) or is there a way to do with standard SolR queries? Will boosting work? If yes, how can i boost by the 2 "Available_From" and "Available_To" fields verified at the same time, and then show the other results sorted by "Ranking" desc ? Thanks in advance to everyone! -- Sent from: https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.472066.n3.nabble.com_Solr-2DUser-2Df472068.html=DwICAg=jf_iaSHvJObTbx-siA1ZOg=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg=uyc4rT6s7dUYCpfdc4jZseKQ7N8HAzBNof59kkyRsxg=
SolR: How to sort (or boost) by Availability dates
i'm facing a big problem in my SolR DB. My objects have a datetime field "Available_From" and a datetime field "Available_To". We also have a "Ranking" field for the sorting that we usually use desc. I can search correctly with direct queries (eg. give me all the items that are available at the moment) but when i do a regular search by other criteria i cannot find a way to show the items that result "available NOW" in the first places in the specific search results, usually sorted by "Ranking" field. How can i do this? Am I forced to write some java classes (the nearest thing i've found is there https://medium.com/@devchaitu18/sorting-based-on-a-custom-function-in-solr-c94ddae99a12) or is there a way to do with standard SolR queries? Will boosting work? If yes, how can i boost by the 2 "Available_From" and "Available_To" fields verified at the same time, and then show the other results sorted by "Ranking" desc ? Thanks in advance to everyone! -- Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html