You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "skanth2012@gmail.com" <sk...@gmail.com> on 2018/10/07 08:07:48 UTC
Using function in fiter query
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
Re: Using function in fiter query
Posted by Emir Arnautović <em...@sematext.com>.
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, skanth2012@gmail.com 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