From java-user-return-50804-apmail-lucene-java-user-archive=lucene.apache.org@lucene.apache.org Sat Sep 17 05:20:16 2011 Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50E9B8E9F for ; Sat, 17 Sep 2011 05:20:16 +0000 (UTC) Received: (qmail 87725 invoked by uid 500); 17 Sep 2011 05:20:14 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 87597 invoked by uid 500); 17 Sep 2011 05:20:13 -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 87574 invoked by uid 99); 17 Sep 2011 05:20:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Sep 2011 05:20:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of seslamian@gmail.com designates 209.85.212.47 as permitted sender) Received: from [209.85.212.47] (HELO mail-vw0-f47.google.com) (209.85.212.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Sep 2011 05:20:08 +0000 Received: by vwe42 with SMTP id 42so8604769vwe.6 for ; Fri, 16 Sep 2011 22:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Bz7XVMO4xG9P6kDT0YF2Dqnld+tXEwilGrtuJkdRpBI=; b=VqdBAtq0Ls6uWmhyCnvyT1sQAP5Xjup7WjlnntUX05XrdCcbMyeTB2sMPQ5Ddh9sU2 rojc4AiE+vrUe7Y1jxYrpFLyO449HKUZbw1stfByZpm7bvgSSteoK3bUpXxjz7YW5H/b QztaevYeB35CZdTzXRR6ty7wEQXHfMjEbLOng= MIME-Version: 1.0 Received: by 10.52.108.196 with SMTP id hm4mr180934vdb.19.1316236787291; Fri, 16 Sep 2011 22:19:47 -0700 (PDT) Received: by 10.220.192.5 with HTTP; Fri, 16 Sep 2011 22:19:47 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 Sep 2011 09:49:47 +0430 Message-ID: Subject: Re: use QueryTermExtractor for RangeQueries From: S Eslamian To: simon.willnauer@gmail.com Cc: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=bcaec548a92b2595c804ad1c4225 --bcaec548a92b2595c804ad1c4225 Content-Type: text/plain; charset=ISO-8859-1 ofcourse I do this. This is my sample cod to get terms: PrefixQuery pq = new PrefixQuery(new Term("field","hell*")); rewritenQuery = indexSearcher.rewrite(pq); QueryTermExtractor qte = new QueryTermExtractor(); WeightedTerm[] wt = qte.getTerms(rewritenQuery ); and it returns nothing to me in wt!!! On Thu, Sep 15, 2011 at 12:36 PM, Simon Willnauer < simon.willnauer@googlemail.com> wrote: > Hey, > > do you use the query you passed to rewrite to extract the terms or the > query returned from rewrite? > > you should do it like this: > > Query q = ... > > q = indexSearcher.rewrite(q); > > ... > > simon > > On Thu, Sep 15, 2011 at 6:02 AM, S Eslamian wrote: > > I have an instance of IndexSearcher and then call rewrite method with the > > query. > > IndexRear ir = IndexReader.open("directory path",true); > > IndexSearcher indexSearcher = new IndexSearcher(ir); > > indexSearcher.rewrite(query); > > > > > > On Wed, Sep 14, 2011 at 10:03 PM, Simon Willnauer > > wrote: > >> > >> how do you rewrite your query? > >> > >> simon > >> > >> On Tue, Sep 13, 2011 at 9:22 AM, S Eslamian > wrote: > >> > Hi > >> > I am using QueryTermExtractor.getTerms for finding the terms of a > given > >> > query in lucene 3.0.3. In it's document has said that "Utility class > >> > used to > >> > extract the terms used in a query, plus any weights. This class will > not > >> > find terms for MultiTermQuery, RangeQuery and PrefixQuery classes so > the > >> > caller must pass a rewritten query (see Query.rewrite) to obtain a > list > >> > of > >> > expanded terms.", but for these queries - MultiTermQuery, RangeQuery > and > >> > PrefixQuery - even rewritten query, it doesn't return the correct list > >> > of > >> > expanded terms. > >> > What should I do? For example for e PrefixQuery like 'hell*' it > returns > >> > 'hell*' instead of " 'hell' and 'hello' and ... "; > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > >> For additional commands, e-mail: java-user-help@lucene.apache.org > >> > > > > > --bcaec548a92b2595c804ad1c4225--