Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 87601 invoked from network); 9 Feb 2007 10:41:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 10:41:28 -0000 Received: (qmail 14637 invoked by uid 500); 9 Feb 2007 10:41:30 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 14599 invoked by uid 500); 9 Feb 2007 10:41:30 -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 14586 invoked by uid 99); 9 Feb 2007 10:41:30 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 02:41:30 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of Sachin.Kainth@atkinsglobal.com designates 217.68.146.190 as permitted sender) Received: from [217.68.146.190] (HELO cluster-b.mailcontrol.com) (217.68.146.190) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 02:41:16 -0800 Received: from SGBD012100.wsatkins.com ([193.117.24.24]) by rly29b.srv.mailcontrol.com (MailControl) with SMTP id l19Aeq3h031171 for ; Fri, 9 Feb 2007 10:40:53 GMT Received: From SGBD012103.wsatkins.com ([10.202.26.17]) by SGBD012100.wsatkins.com (WebShield SMTP v4.5 MR2); id 1171017632164; Fri, 9 Feb 2007 10:40:32 +0000 Received: from SGBLOW2101.wsatkins.com ([10.22.33.30]) by SGBD012103.wsatkins.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Feb 2007 10:40:31 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: categorisation Date: Fri, 9 Feb 2007 10:40:30 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: categorisation Thread-Index: AcdLsGOblrUbnvD6TPy0Ax86EDMfsgAhkAPg References: <58D0497D-3CC2-4947-96D6-1D7ADE08828F@ehatchersolutions.com> From: "Kainth, Sachin" To: X-OriginalArrivalTime: 09 Feb 2007 10:40:31.0717 (UTC) FILETIME=[B8E2E150:01C74C36] X-Scanned-By: MailControl A-07-06-80 (www.mailcontrol.com) on 10.66.0.139 X-Virus-Checked: Checked by ClamAV on apache.org It makes sense to me only if you tell me that all the bits in the BitSet "all" will be 1.=20 -----Original Message----- From: Erik Hatcher [mailto:erik@ehatchersolutions.com]=20 Sent: 08 February 2007 18:37 To: java-user@lucene.apache.org Subject: Re: categorisation On Feb 8, 2007, at 12:36 PM, Kainth, Sachin wrote: > Chris has given an example of how to perform categorisation of lucene=20 > searches: > > String[] mfgs =3D ...; > String query =3D "+category:cameras +price:[0 to 10]"; > Query q =3D QueryParser.parse(query); > Hits results =3D searcher.search(q, mySort) > BitSet all =3D (new QueryFilter(q)).bits(reader) > int[] mfg_counts =3D new int[mfgs.length]; > for i in (0 to mfgs.length) { > BitSet these =3D (new QueryFilter(new TermQuery("mfg",mfgs=20 > [i]))).bits(reader); > these.and(all) > mfg_counts[i] =3D these.cardinality(); > } > > What I don't understand though is what this line does: > > BitSet all =3D (new QueryFilter(q)).bits(reader) > > Anyone have any ideas? "all" is a BitSet lit up for the documents that matched "query".=20=20=20 "these" (the BitSet for a particular category) is .anded with "all"=20=20 to get the counts _left over_ for each category given "query". Make sense? Erik --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org This message has been scanned for viruses by MailControl - (see http://bluepages.wsatkins.co.uk/?4318150) This email and any attached files are confidential and copyright protected.= If you are not the addressee, any dissemination of this communication is s= trictly prohibited. Unless otherwise expressly agreed in writing, nothing s= tated in this communication shall be legally binding. The ultimate parent company of the Atkins Group is WS Atkins plc. Register= ed in England No. 1885586. Registered Office Woodcote Grove, Ashley Road, = Epsom, Surrey KT18 5BW. Consider the environment. Please don't print this e-mail unless you really = need to.=20 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org