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 C2185D9DC for ; Mon, 20 Aug 2012 13:34:53 +0000 (UTC) Received: (qmail 14243 invoked by uid 500); 20 Aug 2012 13:34:51 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 14187 invoked by uid 500); 20 Aug 2012 13:34:51 -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 14179 invoked by uid 99); 20 Aug 2012 13:34:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2012 13:34:51 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jochenhebbrecht@gmail.com designates 209.85.216.41 as permitted sender) Received: from [209.85.216.41] (HELO mail-qa0-f41.google.com) (209.85.216.41) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Aug 2012 13:34:43 +0000 Received: by qafk30 with SMTP id k30so3332541qaf.14 for ; Mon, 20 Aug 2012 06:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lgv5NkroY98C8gTMedjzxbqFycYGzHKMm5XtSLIov5k=; b=vFOnVBnWx5zf0hn4tl+MLIWgSZcjinQ0S1EjeVraXJWQDk1cxEOdaK/FHrizHHxLis PRXWWp1UHvrqUt1NTVkRPwcIsFbv2k2jPqz1Vo8EFwhsoXjJco5vbnxaY1w6TNJxO6C7 MasQ7T4AePPQy+gJaD3GJ4d9SSCSjIQzoQwjDwyr2u8viyGwHLwVsV1mm1IkjxM7zNPF RIzVZ2e6Pc2HKJ323mVNRK+N4uqP8IESI8oUdf3PmMlkW4ryt8WDDWGRLOjz5E+zzg4T f4TFLKMGMdF38ubvCXlC3pjbGJdrWd8hP926OmeiPPGqlIKQPvm/oGeDMuEQt5AR+RcF TpOA== MIME-Version: 1.0 Received: by 10.229.106.130 with SMTP id x2mr13132046qco.121.1345469662804; Mon, 20 Aug 2012 06:34:22 -0700 (PDT) Received: by 10.229.66.15 with HTTP; Mon, 20 Aug 2012 06:34:22 -0700 (PDT) In-Reply-To: References: Date: Mon, 20 Aug 2012 15:34:22 +0200 Message-ID: Subject: Re: TermRangeQuery with multiple words From: Jochen Hebbrecht To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=00235429dcb84ebbe504c7b29108 --00235429dcb84ebbe504c7b29108 Content-Type: text/plain; charset=ISO-8859-1 Hmm, just thinking. I could split the value on spaces. Then I can say: +TEST:Microsoft +TEST:[Belgium TO Spain] I just tested it, and it seems to work :-) ... 2012/8/20 Jochen Hebbrecht > Hi Ian, > > Thanks for your answer! > Well, my example might have been not so clear. Here's a better example: > > Doc 01: TEST: "Microsoft Belgium" > Doc 02: TEST: "Apple" > Doc 03: TEST: "Microsoft France" > Doc 04: TEST: "Evian" > Doc 05: TEST: "Nokia" > Doc 06: TEST: "Novotel" > Doc 07: TEST: "Microsoft Germany" > Doc 08: TEST: "Microsoft Spain" > > > Now, I want to search for all documents which have the field TEST going > from "Microsoft Belgium" to "Microsoft Spain". > The problem is, I cannot search on multiple terms in a range :-( ... > > What I can do, is to search from "Microsoft" to "Microsoft", this one > works. But not the one stated above ... > So the question is: can Lucene make a String range query on multiple terms? > > Kind regards, > Jochen > > > 2012/8/20 Ian Lea > >> This won't work with TermRangeQuery because neither "test 1" not "test >> 3" are terms. "test" will be a term, output by the analyzer. You'll >> be able to see the indexed terms in Luke. >> >> Sounds very flaky anyway - you'd get "term 10 xxx" and "term 100 xxx" >> as well as "term 1" and "term 2". If your TEST values are that >> predictable you could split them up and index the number separately, >> maybe using NumericField and build a query using NumericRangeQuery. >> >> RegexQuery in contrib-queries might also be worth a look. >> >> >> -- >> Ian. >> >> On Mon, Aug 20, 2012 at 12:59 PM, Jochen Hebbrecht >> wrote: >> > Hi, >> > >> > I have 5 documents. Each document has a field TEST. Total structure is >> > looking like this: >> > >> > Doc 01: TEST: "test 1 string" >> > Doc 02: TEST: "test 2 string" >> > Doc 03: TEST: "test 3 string" >> > Doc 04: TEST: "test 4 string" >> > Doc 05: TEST: "test 5 string" >> > >> > These fields are indexed as Index.Analyzed with the StandardAnalyzer. >> > With Luke, I can see for example: >> > >> > Document: Doc 01 >> > Field: TEST >> > Terms: test, 1, string >> > >> > But now I want to make rangesearch as: >> > >> > << >> > new TermRangeQuery("TEST", "test 1", "test 3", true, true); >> >>> >> > >> > ... to pickup the first 3 documents. Unfortunately, this doesn't seem to >> > work for multiple words. >> > >> > Can somebody help me correcting my TermRangeQuery? >> > >> > Thanks! >> > Jochen >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org >> For additional commands, e-mail: java-user-help@lucene.apache.org >> >> > --00235429dcb84ebbe504c7b29108--