lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Stored values and date math query
Date Sat, 02 Mar 2013 19:49:43 GMT

: 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
View raw message