Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 43788 invoked from network); 14 May 2010 13:09:03 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 May 2010 13:09:03 -0000 Received: (qmail 43782 invoked by uid 500); 14 May 2010 13:09:01 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 43639 invoked by uid 500); 14 May 2010 13:09:00 -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 43631 invoked by uid 99); 14 May 2010 13:09:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 13:09:00 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gsiasf@gmail.com designates 209.85.160.176 as permitted sender) Received: from [209.85.160.176] (HELO mail-gy0-f176.google.com) (209.85.160.176) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 13:08:55 +0000 Received: by gyf1 with SMTP id 1so1410010gyf.35 for ; Fri, 14 May 2010 06:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=9RPLKVvBXhF7wJBlfSgbGmotWh3Y12zL9IS1l1kgS5o=; b=F6t5R0O4njlmzs0x29u3DKS3OURXhXFnGOsEBFdmED07UEGhaNm8oxUtdY9X48qMgp 3ydW3sacaqOn/Z/M38esTAiK1jEAWgrR1pl8vSCU6ODUsYiVKnLpiJydKOxB7URq7ya2 NizfHsSCvEJLHv758PGPY2E24DbAixy7iy9b4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=XtCYHa29PvbLU93KuzQyFeAozr1qhHKtq/1JMKcy4nQkzxZEDjgSoYscnWUi0f1/1P xxFUdFBVLxJoYT9htwBnv2iR0WspFXlwFVKsYGLeEvQfYy1PH6nfBTCA8SLeK+G6KGQz Kper5OKjYGBpc0xywAkrsu32kjlQHTQzqjNAs= Received: by 10.100.236.5 with SMTP id j5mr1216872anh.202.1273842513633; Fri, 14 May 2010 06:08:33 -0700 (PDT) Received: from [10.0.0.77] (adsl-065-013-152-164.sip.rdu.bellsouth.net [65.13.152.164]) by mx.google.com with ESMTPS id t2sm2219339ani.8.2010.05.14.06.08.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 14 May 2010 06:08:33 -0700 (PDT) Sender: Grant Ingersoll Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: TermDocs From: Grant Ingersoll In-Reply-To: <20100512223913.979D7478445@athena.apache.org> Date: Fri, 14 May 2010 09:08:31 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <6D8B25C5-D1DB-4E13-8D81-9023945E58DD@apache.org> References: <20100512223913.979D7478445@athena.apache.org> To: java-user@lucene.apache.org X-Mailer: Apple Mail (2.1078) On May 12, 2010, at 7:42 PM, roy-lucene-user@xemaps.com wrote: > Hi guys, >=20 > I've had this code for some time but am just now questioning if it = works. >=20 > I have a custom filter that i've been using since Lucene 1.4 to Lucene = 2.2.0 and it essentially builds up a BitSet like so: >=20 > for ( int x =3D 0; x < fields.length; x++ ) { > for ( int y =3D 0; y < values.length; y++ ) { > TermDocs termDocs =3D reader.termDocs( new Term( fields[x], = values[y] ) ); > try { > while ( termDocs.next() ) { > int doc =3D termDocs.doc(); > bits.set( doc ); > } > } > finally { > termDocs.close(); > } > } > } >=20 > I notice that it grabs all the TermDocs for the first field and value = but nothing after that. But I do know that the other values exist but I = don't get any TermDocs afterwards. >=20 That code works for me against Lucene 3.0.1 (and I don't think much has = changed there). Are you sure the fields and values are lining up right? = Perhaps isolate this on a standalone index to convince yourself. Have = you looked at Luke to validate? However, why not just create a Filter from a Query and get the = bitset/docidset using the MultiFieldQueryParser? //Here's a snippet I wrote, never mind the PayloadAnalyzer, just = substitute in your analyzer MultiFieldQueryParser mfqp =3D new = MultiFieldQueryParser(Version.LUCENE_30, fields, new = PayloadAnalyzer(encoder)); Query query =3D mfqp.parse(Version.LUCENE_30, values, fields, new = PayloadAnalyzer(encoder)); Filter filter =3D new QueryWrapperFilter(query); DocIdSet docs =3D filter.getDocIdSet(reader); DocIdSetIterator docIdSetIterator =3D docs.iterator(); while (docIdSetIterator.nextDoc() !=3D = DocIdSetIterator.NO_MORE_DOCS){ System.out.println("Doc: " + docIdSetIterator.docID()); } -------------------------- Grant Ingersoll http://www.lucidimagination.com/ Search the Lucene ecosystem using Solr/Lucene: = http://www.lucidimagination.com/search --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org