Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 64173 invoked from network); 12 Feb 2009 00:56:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2009 00:56:23 -0000 Received: (qmail 83168 invoked by uid 500); 12 Feb 2009 00:56:17 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 83137 invoked by uid 500); 12 Feb 2009 00:56:17 -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 83126 invoked by uid 99); 12 Feb 2009 00:56:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 16:56:17 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [203.89.202.182] (HELO postoffice2.aconex.com) (203.89.202.182) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 00:56:09 +0000 X-ASG-Debug-ID: 1234400146-131400610000-H1Y1KX X-Barracuda-URL: http://postoffice2.aconex.com:8000/cgi-bin/mark.cgi Received: from postoffice.aconex.com (localhost [127.0.0.1]) by postoffice2.aconex.com (Spam Firewall) with ESMTP id 6FDD8F9881 for ; Thu, 12 Feb 2009 11:55:46 +1100 (EST) Received: from postoffice.aconex.com (postoffice.yarra.acx [192.168.102.1]) by postoffice2.aconex.com with ESMTP id DKLxEZvoDgrwk6EO for ; Thu, 12 Feb 2009 11:55:46 +1100 (EST) Received: from [192.168.5.132] (melho0.aconex.com [203.89.192.141]) by postoffice.aconex.com (Postfix) with ESMTP id 513BA92C0DA for ; Thu, 12 Feb 2009 11:55:46 +1100 (EST) Message-ID: <4993737B.60005@aconex.com> Date: Thu, 12 Feb 2009 11:55:23 +1100 From: Paul Cowan Organization: Aconex User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: java-user@lucene.apache.org X-ASG-Orig-Subj: Re: Fields with multiple values... Subject: Re: Fields with multiple values... References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Barracuda-Connect: postoffice.yarra.acx[192.168.102.1] X-Barracuda-Start-Time: 1234400146 X-Barracuda-Virus-Scanned: by Aconex Staff Email Spam Firewall at aconex.com X-Virus-Checked: Checked by ClamAV on apache.org Dragon Fly wrote: > I'd like to get a hit if I do: > Field1:A AND Field2:C > This is fine because that's how Lucene works. However, I do not want to get a hit if I do: > Field1:A AND Field2:D > The reason that I don't want a hit is because A is the first element in Field1 and D is the second element in Field2. I only want a hit when both values are at the same array index. Is there a way to do this? Thank you in advance for your help. With a bit of fudging, you may be able to use a SpanNearQuery to do this -- though you'll need to change your analyzer's positionIncrementGap, and depending on how many tokens you'll have for each field (if it varies between fields) you may need to patch Lucene to change the way the gaps are calculated. I've done a prototype of exactly this (SpanNearQuery and analyzer changes) for a very similar situation here and it works BRILLIANTLY -- massively, massively faster for us than indexing a new document for each set of 'subfields'. I've put some patches against https://issues.apache.org/jira/browse/LUCENE-1494 -- I think this approach might work for you. Let me know if you need clarification. Cheers, Paul --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org