Hi Emir,
In the first query I'm getting 2 documents (correct) 
http://localhost:8983/solr/COL1/select?fq=F3:Active&indent=on&q={!frange%20l=1}or(query($q1),query($q2))&q1=F1:0732695731&q2=F2:1040167165&rows=0&wt=json

In the second document I've 0 document as result
http://localhost:8983/solr/COL1/select?indent=on&fq={!frange%20l=1}or(query($q1),query($q2))&q1=F1:0732695731&q2=F2:1040167165&rows=0&wt=json


Regards,Nabil.

      De : Emir Arnautovic <emir.arnauto...@sematext.com>
 À : solr-user@lucene.apache.org 
 Envoyé le : Lundi 5 septembre 2016 10h48
 Objet : Re: Use function in condition
   
Hi Nabil,

Can you please share exact queries that are executed and results.

Thanks,
Emir


On 05.09.2016 10:43, nabil Kouici wrote:
> Hi Emir,
> Yes I confirm, it's working. But if I put the same condition in fq the result 
> is different (result is correct when I put condition in q).
> Thank you.
> Regards,Nabil.
>
>        De : Emir Arnautovic <emir.arnauto...@sematext.com>
>  À : solr-user@lucene.apache.org
>  Envoyé le : Lundi 5 septembre 2016 10h30
>  Objet : Re: Use function in condition
>    
> Hi Nabil,
>
> It should work. I've just tested on gettingstarted collection (sample
> that comes with Solr) and this query returns expected results. Here is
> what test query looks like:
>
> http://localhost:8983/solr/gettingstarted/select?q=*:*&fq={!frange
> l=1}or(query($q1),query($q2))&q1=id:adata&q2=id:apple
>
> Can you please doublecheck if your query part returns any results.
>
> Regards,
> Emir
>
>
> On 05.09.2016 09:54, nabil Kouici wrote:
>> Hi All,
>> Any feedback please.
>> Regards,Nabil.
>>
>>          De : nabil Kouici <koui...@yahoo.fr.INVALID>
>>    À : "solr-user@lucene.apache.org" <solr-user@lucene.apache.org>
>>    Envoyé le : Vendredi 2 septembre 2016 13h45
>>    Objet : Re: Use function in condition
>>      
>> Hi Emir,
>> Thank you for your response.
>> Yes your request is working but only if it's function queries.
>> If you mix function query with normal query, this will not work. For example:
>> fq={!frange 
>> l=1}and(query($sub1),or(query($sub2),query($sub3)))&sub1=F3:Active&sub2={!frange
>>  u=2000}sum(F3,F4)&sub3={!frange l=3000}sum(F5,F6)
>> Regards,Nabil.
>>
>>          De : Emir Arnautovic <emir.arnauto...@sematext.com>
>>    À : solr-user@lucene.apache.org
>>    Envoyé le : Lundi 29 août 2016 14h06
>>    Objet : Re: Use function in condition
>>      
>> Hi Nabil,
>>
>> Can you try following:
>>
>> fq={!frange 
>> l=1}and(query($sub1),or(query($sub2),query($sub3)))&sub1={!frange 
>> l=1000}sum(F1,F2)&sub2={!frange u=2000}sum(F3,F4)&sub3={!frange 
>> l=3000}sum(F5,F6)
>>
>> Thanks,
>> Emir
>>
>> On 29.08.2016 11:50, nabil Kouici wrote:
>>> Hi solr users,
>>> I'm still not able to find a solution either with function query :(
>>> My need is simple, I'd like to execute these combined filters :
>>> (Sum F1 and F2 greater than 1000) AND ( (sum F3 and F4 lower than 2000) OR 
>>> (sum F5 and F6 greater then 3000) )
>>> Could you please help me to translate these conditions to solr syntaxe.
>>> Regards,Nabil.
>>>
>>>            De : Emir Arnautovic <emir.arnauto...@sematext.com>
>>>      À : solr-user@lucene.apache.org
>>>      Envoyé le : Jeudi 25 août 2016 16h51
>>>      Objet : Re: Use function in condition
>>>        
>>> Hi Nabil,
>>>
>>> You have limited set functions, but there are logical functions: or,
>>> and, not and you have query function so can do more complex queries:
>>>
>>> fq={!frange l=1}and(query($sub1),termfreq(field3, 300))sub1={!frange 
>>> l=100}sum(field1,field2)
>>>
>>> And will return 1 for doc matching both function terms.
>>>
>>> It would be much simpler if Solr supported relational functions: gt, lt, eq.
>>>
>>> Hope this gives you ideas how to proceed.
>>>
>>> Emir
>>>
>>> On 25.08.2016 12:06, nabil Kouici wrote:
>>>> Hi Emir,Thank you for your replay. I've tested the function range query 
>>>> and this is solving 50% my need. The problem is I'm not able to use it 
>>>> with other conditions. For exemple:
>>>> fq={!frange l=100}sum(field1,field2)  and field3:200
>>>>
>>>> or
>>>> fq=({!frange l=100}sum(field1,field2))  and (field3:200)
>>>>
>>>> This is giving me an exception:org.apache.solr.search.SyntaxError: 
>>>> Unexpected text after function: AND Field3:200
>>>> I know that I can use multiple fq but the problem is I can have complexe 
>>>> filter like (cond1 OR cond2 AND cond3)
>>>> Could you please help.
>>>> Regards,Nabil.
>>>>
>>>>              De : Emir Arnautovic <emir.arnauto...@sematext.com>
>>>>        À : solr-user@lucene.apache.org
>>>>        Envoyé le : Mercredi 17 août 2016 17h08
>>>>        Objet : Re: Use function in condition
>>>>          
>>>> Hi Nabil,
>>>>
>>>> You can use frange queries, e.g. you can use fq={!frange
>>>> l=100}sum(field1,field2) to filter doc with sum greater than 100.
>>>>
>>>> Regards,
>>>> Emir
>>>>
>>>>
>>>> On 17.08.2016 16:26, nabil Kouici wrote:
>>>>> Hi,
>>>>> Is it possible to use functions (function query 
>>>>> https://cwiki.apache.org/confluence/display/solr/Function+Queries) in q 
>>>>> or fq parameters to build a complex search expression.
>>>>> For exemple, take only documents that sum(field1,field2)> 100. Another 
>>>>> exemple: if(test,value1,value2):vallue3
>>>>> Regards,Nabil.

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



   

Reply via email to