Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 94353 invoked from network); 24 Feb 2007 00:18:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Feb 2007 00:18:12 -0000 Received: (qmail 21223 invoked by uid 500); 24 Feb 2007 00:18:15 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 21196 invoked by uid 500); 24 Feb 2007 00:18:15 -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 21173 invoked by uid 99); 24 Feb 2007 00:18:15 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2007 16:18:15 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [169.229.70.167] (HELO rescomp.berkeley.edu) (169.229.70.167) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Feb 2007 16:18:04 -0800 Received: by rescomp.berkeley.edu (Postfix, from userid 1007) id 28FD85B766; Fri, 23 Feb 2007 16:17:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by rescomp.berkeley.edu (Postfix) with ESMTP id 24B1E7F403 for ; Fri, 23 Feb 2007 16:17:43 -0800 (PST) Date: Fri, 23 Feb 2007 16:17:43 -0800 (PST) From: Chris Hostetter To: Lucene Users Subject: Re: ConstantScoreQuery and MatchAllDocsQuery In-Reply-To: <0JDW004PK0UTOKI0@VL-MH-MR002.ip.videotron.ca> Message-ID: References: <0JDW004PK0UTOKI0@VL-MH-MR002.ip.videotron.ca> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org : I ask this because I need to return the frequency of the search terms : with each of my results, I tried using the TermFreqVector object but : unfortunately it was not fast enough, so I decided to modifiy lucene to : be able to return the frequency the same way the score is returned by : org.apache.lucene.search.Hits. ... : I started by adding public abstract int freq(); in package : org.apache.lucene.search.Scorerabstract class, and then modified : everyimplementation of Scorer to be able to get the frequency. can you elaborate on: * how you were trying to use TermFreqVector * how you define "fast enough" * how you are now getting the freq() value in all of the Scorer classes? If all you need to know is the frequency of each term in your query (and not hte frequency of all terms in teh document) did you try using the freq() method in the TermDocs iterator instead of the TermFreqVector class? using Query.extractTerms, and then getting a TermDocs instance and iterating over those terms using seek and over the docids from your results using skipTo should be an extremely fast way to get the freq() info. : It works well and fast, the only problem I have is that I did not find a : way to compute the frequency in both ConstantScoreQuery.java and : MatchAllDocsQuery.java internal scorers. neither of those queries involve any terms, so i'm not sure what freq() would even make sense ... "1" or "0" i would imagine. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org