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 <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),2628000000),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" <federico.co...@digibusiness.it>
> 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&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg&s=bgStMXTIXUGU1HG4dIgafvDG7gDRfLDHxqV9tiPsa_8&e=
> )
>     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&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=_8ViuZIeSRdQjONA8yHWPZIBlhj291HU3JpNIx5a55M&m=iCvyvST3PYrt8QATUq_UaCpoHECIsgvkQgpZ1073OLg&s=uyc4rT6s7dUYCpfdc4jZseKQ7N8HAzBNof59kkyRsxg&e=
>
>
>

Reply via email to