Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 16373 invoked from network); 30 Jul 2007 14:22:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2007 14:22:08 -0000 Received: (qmail 51133 invoked by uid 500); 30 Jul 2007 14:22:01 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51103 invoked by uid 500); 30 Jul 2007 14:22:01 -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 51092 invoked by uid 99); 30 Jul 2007 14:22:01 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2007 07:22:01 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of erickerickson@gmail.com designates 209.85.128.187 as permitted sender) Received: from [209.85.128.187] (HELO fk-out-0910.google.com) (209.85.128.187) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2007 14:21:57 +0000 Received: by fk-out-0910.google.com with SMTP id z23so147955fkz for ; Mon, 30 Jul 2007 07:21:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=I5TGNaxavhZoTbk7imHA+tPb0YV6Ujf8hUqUwVIqjovo/mF249C4IJQbTNWELQiALb3bFNQ2fQ6gRViFPTNDz3O9ApHnGi7k8PKHvv56WEGTSn2Y+p/tRpV7s4vh0+3hEMB8eIUxSymyNV3Le3RdS86rjq9zqMD5pOeYI14c3dg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=DpupJ2BOJayBHFlifjRMr06Rr2jwwW3bJipG4Hd4Vn3lIPWVyyRPf9HPGJcNb/rdPQd6wtOCfDpOMdAmRrKb+d+HJrwFOaNW0f+GqFjh2LnLbwG7RV52t5S4aXXlj1WdO65mFJd+3PkQkVHblftrxnoby4c4CHRMwnPQBS7kcYA= Received: by 10.82.112.3 with SMTP id k3mr4303426buc.1185805295749; Mon, 30 Jul 2007 07:21:35 -0700 (PDT) Received: by 10.82.167.3 with HTTP; Mon, 30 Jul 2007 07:21:35 -0700 (PDT) Message-ID: <359a92830707300721r49811895g2091804847c66847@mail.gmail.com> Date: Mon, 30 Jul 2007 10:21:35 -0400 From: "Erick Erickson" To: java-user@lucene.apache.org Subject: Re: How to show category count with results? In-Reply-To: <200707261528.l6QFSSXx031875@pigeon.ciao.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_18868_28216150.1185805295622" References: <00b401c7cf98$73167a20$150410ac@bhavin> <200707261528.l6QFSSXx031875@pigeon.ciao.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_18868_28216150.1185805295622 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline You might want to search the mail archive for "facets" or "faceted search" (no quotes), as I *think* this might be relevant. Best Erick On 7/26/07, Ramana Jelda wrote: > > Hi , > Of course this statement is very expensive. > -->document.get("CAMPCATID")==null?"":document.get("CAMPCATID"); > > Use StringIndex/FieldCache/something similar to implement category > counting. > :) > > Jelda > > > -----Original Message----- > > From: Bhavin Pandya [mailto:bhavinp@rediff.co.in] > > Sent: Thursday, July 26, 2007 5:20 PM > > To: java-user@lucene.apache.org > > Subject: How to show category count with results? > > > > Hi, > > > > I want to show each category name and its count with results. > > I achieved this using DocCollector but its very slow when no > > of results in lacs... As fetching of documents from reader in > > collect method is expensive... > > > > public void collect(int doc, float score) { > > Document document = mreader.document(doc); > > strcatid = > > document.get("CAMPCATID")==null?"":document.get("CAMPCATID"); > > > > if (catcountmap.containsKey(strcatid)) > > { > > // catid already exists in hashmap... increase count by one > > > > value = ((Integer)catcountmap.get(strcatid)).intValue(); > > value = value + 1; > > catcountmap.put(strcatid,new Integer(value)); > > } > > else > > catcountmap.put(strcatid,new Integer(1)); > > > > } > > > > > > is there any other better way to achieve this ???? > > > > > > Thanks. > > Bhavin pandya > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ------=_Part_18868_28216150.1185805295622--