Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C95189570 for ; Wed, 15 Feb 2012 11:34:16 +0000 (UTC) Received: (qmail 71924 invoked by uid 500); 15 Feb 2012 11:34:14 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 71865 invoked by uid 500); 15 Feb 2012 11:34:14 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 71856 invoked by uid 99); 15 Feb 2012 11:34:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2012 11:34:14 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Thierry.Delalande@uk.daiwacm.com designates 195.245.230.34 as permitted sender) Received: from [195.245.230.34] (HELO mail1.bemta3.messagelabs.com) (195.245.230.34) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2012 11:34:04 +0000 Received: from [195.245.230.131:58414] by server-11.bemta-3.messagelabs.com id 3F/9A-01931-8189B3F4; Wed, 15 Feb 2012 11:33:44 +0000 X-Env-Sender: Thierry.Delalande@uk.daiwacm.com X-Msg-Ref: server-4.tower-78.messagelabs.com!1329305608!16038465!13 X-Originating-IP: [212.119.17.154] X-StarScan-Version: 6.5.5; banners=uk.daiwacm.com,-,- X-VirusChecked: Checked Received: (qmail 7022 invoked from network); 15 Feb 2012 11:33:44 -0000 Received: from unknown (HELO lonmlfep01.daiwaeurope.local) (212.119.17.154) by server-4.tower-78.messagelabs.com with SMTP; 15 Feb 2012 11:33:44 -0000 Received: from lonmlmbp01.daiwaeurope.local ([172.30.48.138]) by lonmlfep01.daiwaeurope.local with Microsoft SMTPSVC(6.0.3790.4675); Wed, 15 Feb 2012 11:33:43 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CCEBD5.ABB35019" Subject: Short circuit AND or subquerying in lucene for performance Date: Wed, 15 Feb 2012 11:33:42 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Short circuit AND or subquerying in lucene for performance Thread-Index: Aczr1atcimWnm+c0QWOM5bWtlJFXHA== From: "Delalande, Thierry" To: X-OriginalArrivalTime: 15 Feb 2012 11:33:43.0609 (UTC) FILETIME=[AC2CF290:01CCEBD5] X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01CCEBD5.ABB35019 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 I've been looking for a short circuit AND operator in Lucene or a way to do subquerying. Basically for queries such as field1:foo AND field2:*bar, I think it would be highly beneficial to restrict evaluation of the second field on the result of the first to avoid scanning the index in its entirety due to the leading wildcard. This can be seen as a subquery (running a query only on the result of a first query) or as a short circuit AND, and would exist for performance reasons. Using SAND to denote the short-circuit variety, the short-circuit expression x SAND y is equivalent to the conditional expression if x then y else false. =20 So my example query would be more performant expressed as field1:foo SAND field2:*bar Other examples: field1:(foo AND *bar) would be more performant expressed as field1:(foo SAND *bar) =20 Please let me know what's already possible in terms of subquerying and what it would take to implement this new operator in Lucene. =20 Thanks **************************************************************** Daiwa Capital Markets Europe Limited is registered in England (registered = number 01487359). The registered office is at 5 King William Street, Londo= n EC4N 7AX. The company is authorised and regulated by The Financial Servi= ces Authority and is a member of the London Stock Exchange. The information contained in this E-Mail is confidential unless the sender= has specifically stated otherwise. If you are not the intended recipient = please notify Daiwa Capital Markets Europe Limited at the sender's address= and delete it immediately. Communications sent by or to any person throug= h our computer systems may be viewed by other personnel and agents of Daiw= a Capital Markets Europe Limited . The sender does not intend by sending t= his message to form a contract with the recipient, and Daiwa Capital Marke= ts Europe Limited, its affiliates and staff do not accept any liability fo= r the contents of this message. The information contained herein has been obtained from sources we believe= to be reliable but we do not represent that it is accurate or complete, a= nd therefore, Daiwa Capital Markets Europe Limited, its affiliates and sta= ff cannot be held responsible or liable for the contents of this message.= The foregoing is not an offer or solicitation to buy or sell any security= , instrument or investment. In addition Daiwa Capital Markets Europe Limit= ed, or any affiliated company, may have an interest, position, or effect t= ransactions, in any investment mentioned herein. Any opinions or recommend= ations expressed herein are solely those of the author or analyst. ------_=_NextPart_001_01CCEBD5.ABB35019--