Using function in fiter query

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

Using function in fiter query

skanth2012@gmail.com
Hi,

I need help on using a custom function in filter query. Can anyone help on
how to get it wokring. Below is the problem statement.

Have a date field in long and a buffer time in milliseconds in the documents
which can vary.

startTime: 1538866800000
bufferTime: 86400

Need to query for docs who's startTime is currentTime - bufferTime

like:

fq=startTime:[* TO sub(NOW, bufferTime)]

Thanks,
skanth





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Using function in fiter query

Emir Arnautović
Hi Skanth,
You can use FunctionRangeQueryParser to do that:
https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-FunctionRangeQueryParser <https://lucene.apache.org/solr/guide/6_6/other-parsers.html#OtherParsers-FunctionRangeQueryParser>

Let us know if you are having troubles forming query. You have examples in https://lucene.apache.org/solr/guide/6_6/function-queries.html#FunctionQueries-UsingFunctionQuery <https://lucene.apache.org/solr/guide/6_6/function-queries.html#FunctionQueries-UsingFunctionQuery>

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



> On 7 Oct 2018, at 10:07, [hidden email] wrote:
>
> Hi,
>
> I need help on using a custom function in filter query. Can anyone help on
> how to get it wokring. Below is the problem statement.
>
> Have a date field in long and a buffer time in milliseconds in the documents
> which can vary.
>
> startTime: 1538866800000
> bufferTime: 86400
>
> Need to query for docs who's startTime is currentTime - bufferTime
>
> like:
>
> fq=startTime:[* TO sub(NOW, bufferTime)]
>
> Thanks,
> skanth
>
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html