lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Indika Tantrigoda <indik...@gmail.com>
Subject Re: Stored values and date math query
Date Tue, 05 Mar 2013 03:20:04 GMT
Thanks for the insights to the query Hoss. I am going to try out the
methods you highlighted.

Thanks,
Indika

On 3 March 2013 01:19, Chris Hostetter <hossman_lucene@fucit.org> wrote:

>
> : sessionAvailableNowQuery = {!edismax}(start_time:[* TO
> : 1970-01-01T12:37:030Z] AND end_time:[1970-01-01T12:37:030Z +
> : (_val_:order_prep_time)MINUTES TO *] AND consumers:[1 TO *] AND
> : session_time_range_available:true)
>
> you can't embed the valuef of a field inside a query string like that (the
> "_val_" hook only lets you embed a function in a place where a query
> clause would normally be expected)
>
> : Is it possible to retrive an integer value from the index and pass it on
> it
> : a date math query ? Is there anything else that needs to be in the query
> ?
>
> not using the date match syntax, but you can use the function syntax to
> write a function that performs a math equation in which two indexed fields
> are the input - and there is an "ms()" function which can be used to get
> the milliseconds since epoch from a date value (either in an indexed field
> or a date match expression), or the diff in milliseconds between two date
> values.
>
> so you should be able to do something like this (untested) in a
> function which should return a positive value if "end_time" is at least
> "order_prep_time" minutes past your input date...
>
>   sub(ms(end_time, 1970-01-01T12:37:030Z),
>       product(order_prep_time,60000))
>
> ..and then you can use that function in the frange parser to only match
> documents with positive values...
>
> fq={frange
> l=0}sub(ms(end_time,1970-01-01T12:37:030Z),product(order_prep_time,60000))
>
>
>
> -Hoss
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message