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