lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhavin Pandya" <>
Subject How to show category count with results?
Date Thu, 26 Jul 2007 15:20:05 GMT

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));
        catcountmap.put(strcatid,new Integer(1));    


is there any other better way to achieve this ????

Bhavin pandya
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message