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 DACD8730B for ; Sun, 18 Sep 2011 19:25:24 +0000 (UTC) Received: (qmail 11698 invoked by uid 500); 18 Sep 2011 19:25:22 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 11644 invoked by uid 500); 18 Sep 2011 19:25:22 -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 11636 invoked by uid 99); 18 Sep 2011 19:25:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Sep 2011 19:25:22 +0000 X-ASF-Spam-Status: No, hits=2.1 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLYTO,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of simon.willnauer@googlemail.com designates 209.85.213.176 as permitted sender) Received: from [209.85.213.176] (HELO mail-yx0-f176.google.com) (209.85.213.176) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Sep 2011 19:25:17 +0000 Received: by yxn22 with SMTP id 22so5390107yxn.35 for ; Sun, 18 Sep 2011 12:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=gWhwnKNrhxTK2gVNSWqm7KOCok9h12JPbqd7SwRUAz0=; b=L1GX4oob3h4G8p3dpOtnMhBVN1PYRoi4p0KIBkutzQTNX765KLavCBBgl8ZZl/0JtJ ifsCcjES1oPEvzCd4iaq4l0RIjeyTUwoVYrpewhLkH8cDY1fXrkxwctPPo1L8oeb4sNm WmuSrWWtbe+CeHy68in3UOSWC7XLK572bsFwI= MIME-Version: 1.0 Received: by 10.236.191.101 with SMTP id f65mr9531604yhn.61.1316373896767; Sun, 18 Sep 2011 12:24:56 -0700 (PDT) Received: by 10.147.39.18 with HTTP; Sun, 18 Sep 2011 12:24:56 -0700 (PDT) Reply-To: simon.willnauer@gmail.com In-Reply-To: References: Date: Sun, 18 Sep 2011 21:24:56 +0200 Message-ID: Subject: Re: use QueryTermExtractor for RangeQueries From: Simon Willnauer To: S Eslamian Cc: java-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 On Sat, Sep 17, 2011 at 7:19 AM, S Eslamian wrote: > 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!!! hmm, (I have to admit I never used QueryTermExtractor) maybe there is no term in the index starting with "hell*" maybe they start with "hell" ? you don't need the asterisk when you create the prefix query directly, no? simon > > On Thu, Sep 15, 2011 at 12:36 PM, Simon Willnauer > 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 >> >> >> > >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org