Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 14810 invoked from network); 11 Feb 2004 07:36:49 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Feb 2004 07:36:49 -0000 Received: (qmail 78752 invoked by uid 500); 11 Feb 2004 07:36:22 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 78614 invoked by uid 500); 11 Feb 2004 07:36:21 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 78590 invoked from network); 11 Feb 2004 07:36:20 -0000 Received: from unknown (HELO b.mail.sonic.net) (64.142.19.5) by daedalus.apache.org with SMTP; 11 Feb 2004 07:36:20 -0000 Received: from frodo (adsl-64-142-37-161.sonic.net [64.142.37.161] (may be forged)) by b.mail.sonic.net (8.12.10/8.12.7) with SMTP id i1B7aWhi002300 for ; Tue, 10 Feb 2004 23:36:32 -0800 Message-ID: <022701c3f071$b90466f0$0200a8c0@frodo> From: "Anand Stephen" To: "Lucene Developers List" References: <400BF93D.8090608@cataloom.com> Subject: Re: Performance for search when I need all Hits Date: Tue, 10 Feb 2004 23:36:11 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I am trying to convert the using Hits to HitCollector. Does anyone have any examples? This is what am trying to do, how do I get the score? Searcher searcher = new IndexSearcher(indexDir); IndexReader indexReader = IndexReader.open(indexDir); final BitSet bits = new BitSet(indexReader.maxDoc()); searcher.search(lquery, new HitCollector() { public void collect(int doc, float score) { bits.set(doc); } }); int size = bits.length(); String[] values = new String[size]; String type = null; ArrayList results = new ArrayList(size); for (int i = 0,j = size; i < j; i++) { final Document document = searcher.doc(i); type = document.get("TYPE"); //hits.doc(i).get("TYPE"); values[i] = document.get("ID"); // System.out.println("score = " + score); // how do i get the score??? // resultsMap.put(hits.doc(i).get("ID"), new Float(score)); } thank you, --a ----- Original Message ----- From: "Erik Hatcher" To: "Lucene Developers List" Sent: Monday, January 19, 2004 9:21 AM Subject: Re: Performance for search when I need all Hits > If you need all search results, use a HitCollector rather than Hits. > Look at the variants of the IndexSearcher.search method. I suspect you > will see the speed with the HitCollector match what you see with your > Hits tricks if not even faster. > > Erik > > > On Jan 19, 2004, at 10:35 AM, Hanjo Riege wrote: > > > Hi all, > > > > i have a question about the performance: > > > > if i need all the results (about 2000 Hits) of a search and read them > > from first to last then it needs about 3000 ms. > > > > After a short look at the method Hits.getMoreDocs(int i) i decided to > > read the last doc first. Now it needs only 1000 ms to read them all. > > > > It seems that the Method is not optimized for getting all the results. > > > > Is this a point for improvement or do i miss something? > > > > regards > > > > Hanjo > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: lucene-dev-help@jakarta.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-dev-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-dev-help@jakarta.apache.org