lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: TermRangeQuery with multiple words
Date Mon, 20 Aug 2012 13:06:03 GMT
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
<jochenhebbrecht@gmail.com> 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


Mime
View raw message