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 Zheng Lin Edwin Yeo <ed...@gmail.com> on 2017/03/02 03:51:18 UTC

OR condition between !frange and normal query

Hi,

Would like to check, how can we do an OR condition between !frange and
normal query?

For example, I want to have the following condition in my query:

({!frange l=1}ms(startDate_dt,endDate_dt) OR
(startDate:[2000-01-01T00:00:00Z TO *] AND endDate:[2016-12-31T23:59:59Z]))

How can we put it in the Solr query URL for Solr to recognize this
condition?

I'm using Solr 6.4.1

Thank you.

Regards,
Edwin

Re: OR condition between !frange and normal query

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Edwin,

_query_ is not field in your index but Solr syntax for subqueries. Not 
sure if that is the issue that you are referring to but query you sent 
(example I sent earlier) is not fully valid - has an extra '('. Can you try:

q=_query_:"{!frange l=1}ms(startDate_dt,endDate_dt)" OR
_query_:"startDate:[2000-01-01T00:00:00Z TO *] AND
endDate:[2016-12-31T23:59:59Z]"

Emir

On 03.03.2017 02:53, Zheng Lin Edwin Yeo wrote:
> Hi Emir,
>
> Thanks for your reply.
>
> For the query:
>
> q=_query_:"({!frange l=1}ms(startDate_dt,endDate_dt)" OR
> _query_:"startDate:[2000-01-01T00:00:00Z TO *] AND
> endDate:[2016-12-31T23:59:59Z]"
>
> Must the _query_  be one of the field in the index? I do not have any
> fields in the index that relates to the output of the query, and if I put
> something that is not one of the fields in the index, it is not returning
> any results.
>
> Regards,
> Edwin
>
>
>
> On 2 March 2017 at 17:04, Emir Arnautovic <em...@sematext.com>
> wrote:
>
>> Hi Edwin,
>>
>> You can use subqueries:
>>
>> q=_query_:"({!frange l=1}ms(startDate_dt,endDate_dt)" OR
>> _query_:"startDate:[2000-01-01T00:00:00Z TO *] AND
>> endDate:[2016-12-31T23:59:59Z]"
>>
>> HTH,
>> Emir
>>
>>
>>
>> On 02.03.2017 04:51, Zheng Lin Edwin Yeo wrote:
>>
>>> Hi,
>>>
>>> Would like to check, how can we do an OR condition between !frange and
>>> normal query?
>>>
>>> For example, I want to have the following condition in my query:
>>>
>>> ({!frange l=1}ms(startDate_dt,endDate_dt) OR
>>> (startDate:[2000-01-01T00:00:00Z TO *] AND endDate:[2016-12-31T23:59:59Z]
>>> ))
>>>
>>> How can we put it in the Solr query URL for Solr to recognize this
>>> condition?
>>>
>>> I'm using Solr 6.4.1
>>>
>>> Thank you.
>>>
>>> Regards,
>>> Edwin
>>>
>>>
>> --
>> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>> Solr & Elasticsearch Support * http://sematext.com/
>>
>>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/


Re: OR condition between !frange and normal query

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Emir,

Thanks for your reply.

For the query:

q=_query_:"({!frange l=1}ms(startDate_dt,endDate_dt)" OR
_query_:"startDate:[2000-01-01T00:00:00Z TO *] AND
endDate:[2016-12-31T23:59:59Z]"

Must the _query_  be one of the field in the index? I do not have any
fields in the index that relates to the output of the query, and if I put
something that is not one of the fields in the index, it is not returning
any results.

Regards,
Edwin



On 2 March 2017 at 17:04, Emir Arnautovic <em...@sematext.com>
wrote:

> Hi Edwin,
>
> You can use subqueries:
>
> q=_query_:"({!frange l=1}ms(startDate_dt,endDate_dt)" OR
> _query_:"startDate:[2000-01-01T00:00:00Z TO *] AND
> endDate:[2016-12-31T23:59:59Z]"
>
> HTH,
> Emir
>
>
>
> On 02.03.2017 04:51, Zheng Lin Edwin Yeo wrote:
>
>> Hi,
>>
>> Would like to check, how can we do an OR condition between !frange and
>> normal query?
>>
>> For example, I want to have the following condition in my query:
>>
>> ({!frange l=1}ms(startDate_dt,endDate_dt) OR
>> (startDate:[2000-01-01T00:00:00Z TO *] AND endDate:[2016-12-31T23:59:59Z]
>> ))
>>
>> How can we put it in the Solr query URL for Solr to recognize this
>> condition?
>>
>> I'm using Solr 6.4.1
>>
>> Thank you.
>>
>> Regards,
>> Edwin
>>
>>
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>

Re: OR condition between !frange and normal query

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Edwin,

You can use subqueries:

q=_query_:"({!frange l=1}ms(startDate_dt,endDate_dt)" OR _query_:"startDate:[2000-01-01T00:00:00Z TO *] AND endDate:[2016-12-31T23:59:59Z]"

HTH,
Emir


On 02.03.2017 04:51, Zheng Lin Edwin Yeo wrote:
> Hi,
>
> Would like to check, how can we do an OR condition between !frange and
> normal query?
>
> For example, I want to have the following condition in my query:
>
> ({!frange l=1}ms(startDate_dt,endDate_dt) OR
> (startDate:[2000-01-01T00:00:00Z TO *] AND endDate:[2016-12-31T23:59:59Z]))
>
> How can we put it in the Solr query URL for Solr to recognize this
> condition?
>
> I'm using Solr 6.4.1
>
> Thank you.
>
> Regards,
> Edwin
>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/