Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 10426 invoked from network); 21 Jul 2006 20:12:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jul 2006 20:12:12 -0000 Received: (qmail 15966 invoked by uid 500); 21 Jul 2006 20:12:05 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 15933 invoked by uid 500); 21 Jul 2006 20:12:05 -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 15915 invoked by uid 99); 21 Jul 2006 20:12:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jul 2006 13:12:05 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.12.10.202] (HELO web25904.mail.ukl.yahoo.com) (217.12.10.202) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 21 Jul 2006 13:12:04 -0700 Received: (qmail 2196 invoked by uid 60001); 21 Jul 2006 20:11:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=Tue2sDMJMJ/cMmREH0tL+NXU9oGz4eAmgkokpZI80zc4T+ocysdap7vlxiFe1WbBTO9qIptO+GIFw5p9EgaprjOE/HpdVcAjGSO42PLLbovRud5JpkE4uyO0bGFWVD+CPAQ6iak5CTkfImk408uuFhw3Gq7gkPdqkHceW5QxdU8= ; Message-ID: <20060721201137.2194.qmail@web25904.mail.ukl.yahoo.com> Received: from [84.131.205.253] by web25904.mail.ukl.yahoo.com via HTTP; Fri, 21 Jul 2006 20:11:37 GMT Date: Fri, 21 Jul 2006 20:11:37 +0000 (GMT) From: eks dev Reply-To: eks dev Subject: Re: Fastest Method for Searching (need all results) To: java-user@lucene.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N have you tried to only collect doc-ids and see if the speed problem is there, or maybe to fetch only field values? If you have dense results it can easily be split() or addSymbolsToHash() what takes the time. I see 3 possibilities what could be slow, getting doc-ids, fetching field value or doing something with this value Would be interesting to know what you get here yeah, I know, it sounds to naive, but sometimes repeting the obvious helps ----- Original Message ---- From: Ryan O'Hara To: java-user@lucene.apache.org Sent: Friday, 21 July, 2006 8:43:41 PM Subject: Fastest Method for Searching (need all results) My index contains approximately 5 millions documents. During a search, I need to grab the value of a field for every document in the result set. I am currently using a HitCollector to search. Below is my code: searcher.search(query, new HitCollector(){ public void collect(int doc, float score){ if(searcher.doc(doc).get("SYM") != null){ addSymbolsToHash(searcher.doc (doc).get("SYM").split("ENDOFSYM")); } } }); This is fairly fast for small and medium-sized result sets. However, it gets slow as the result set grows. I read this on HitCollector's API page: "For good search performance, implementations of this method should not call Searcher.doc(int) or Reader.document(int) on every document number encountered. Doing so can slow searches by an order of magnitude or more." Along with this implementation, I've also tried using FieldCache. This faired better with large-sized result sets, but worse with small and medium-sized result sets. Anyone have any ideas of what the best approach might be? Thanks a lot, Ryan --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org