Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A8C05200B73 for ; Mon, 29 Aug 2016 14:06:55 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A743F160AB8; Mon, 29 Aug 2016 12:06:55 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C4965160AA7 for ; Mon, 29 Aug 2016 14:06:54 +0200 (CEST) Received: (qmail 52423 invoked by uid 500); 29 Aug 2016 12:06:52 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 52411 invoked by uid 99); 29 Aug 2016 12:06:51 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2016 12:06:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 6A41CC00B6 for ; Mon, 29 Aug 2016 12:06:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.72 X-Spam-Level: X-Spam-Status: No, score=-0.72 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=sematext-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id zieS-eOq3T1d for ; Mon, 29 Aug 2016 12:06:47 +0000 (UTC) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 45A8A5F242 for ; Mon, 29 Aug 2016 12:06:47 +0000 (UTC) Received: by mail-wm0-f50.google.com with SMTP id o80so88285977wme.1 for ; Mon, 29 Aug 2016 05:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sematext-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=wykWaWlR2Lrf0VxR6Dgjoq20/55Wpcx7ELBQNZgC4S4=; b=lqo1xF3hL19gINl1au9uKRMCCo5xy4KGWKoziKHuH+x4618Xl5N6v46do9GPF3NdEv Bfc3QDX3CRoEvMLZsquwMTvdZ13VHbQLjwoheiVig4bzUyEpxcd7vBlZc3LqrwHNS8ft /IHMNKOU33lYrY3bCbZkoVO1VBBpdUE6lPlTA2KeJJZTedpnvjW2ripddfCkEq/g/XU4 Qwe488Jig33jit4UYx8T50LQkztOsxiRPzN+Gfxk1KD0hibxo3fuiPRvUBIoar2l9+kI GN9WAp4FrW2A9hzY4BLF0BoZSVCCZTkVlWPLR3friXDWm3ZOu5P0c8YBVCIlanCKyUCc CVXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=wykWaWlR2Lrf0VxR6Dgjoq20/55Wpcx7ELBQNZgC4S4=; b=KrAw3NAg2oZI8/OM5HshGeNLMCpMK0zlf2Q6XB/AMA71Kx7ykYZV137Ay728vnU2wI YxT5HBowRKA21eTel5vwvoU4z292xXsUrlfHRsF4s2cDq7xWBAG5cVZ2a4FzHXp6iVLt Hm/HWE1WEeHf39j3azg5QMM0ANKoRtxT9wOfKN45yVuC04TPQCQ7WMfRtUNzVcxV3Ekd Xr5qJo1bkhx6/upnj8r5U84tPvVmkk3EUilfHlQ7aIQyp8IcWYHadw5qef/GDhx7z1vN VAHZkGN1r8NYVNzY81CXXz/QxQ12DdzoHOmLVy0x3Xc2+73zHORnDNu8OixOjdhFfN9I mzfg== X-Gm-Message-State: AE9vXwMxobuDuq+OQChNqyJbspQYD3tlzlnntM9cx9ugxwnCMmkssRUptjDe4WLW34/IdA== X-Received: by 10.28.25.71 with SMTP id 68mr9772144wmz.19.1472472406572; Mon, 29 Aug 2016 05:06:46 -0700 (PDT) Received: from [192.168.0.106] (cable-77-77-225-159.dynamic.telemach.ba. [77.77.225.159]) by smtp.gmail.com with ESMTPSA id e12sm13198967wmg.17.2016.08.29.05.06.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Aug 2016 05:06:45 -0700 (PDT) Subject: Re: Use function in condition To: solr-user@lucene.apache.org References: <940659116.26207756.1471443990325.JavaMail.yahoo.ref@mail.yahoo.com> <940659116.26207756.1471443990325.JavaMail.yahoo@mail.yahoo.com> <02d13af1-6c79-bcce-6c0a-5a8b1aa13cd3@sematext.com> <339370704.1879782.1472119563755.JavaMail.yahoo@mail.yahoo.com> <1088812269.2112683.1472464257955@mail.yahoo.com> From: Emir Arnautovic Message-ID: <26c1d214-daef-4929-926a-458223b20604@sematext.com> Date: Mon, 29 Aug 2016 14:06:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1088812269.2112683.1472464257955@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit archived-at: Mon, 29 Aug 2016 12:06:55 -0000 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 > À : 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 >> À : 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/