lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doron Cohen" <cdor...@gmail.com>
Subject Re: Number range search
Date Wed, 13 Aug 2008 12:50:03 GMT
The code seems correct (although it doesn't show
which analyzer was used at indexing).

Note that when adding numbers like this there's no real point in analyzing
them,
so I would add that field as UN_TOKENIZED. This would be more efficient,
and would also comply with the query parser who does not apply
the analyzer on range query terms. Anyhow this does not explain the problem
you see, because standard analyzer would not modify the numbers anyhow.

Which Lucene version version you are using?

Can you provide a small self-containing program demonstrating the unexpected
behavior?

(often just writing this small program shows leads to solve a problem like
this).

Doron

On Wed, Aug 13, 2008 at 12:55 PM, m.harig <m.harig@gmail.com> wrote:

>
> hi all.
>
>  am indexing a price field by
>
> doc.add(new Field("price", "1450", Field.Store.YES,
>                                        Field.Index.TOKENIZED));
> doc.add(new Field("price", "3800", Field.Store.YES,
>                                        Field.Index.TOKENIZED));
> doc.add(new Field("price", "2500", Field.Store.YES,
>                                        Field.Index.TOKENIZED));
> doc.add(new Field("price", "7020", Field.Store.YES,
>                                        Field.Index.TOKENIZED));
> doc.add(new Field("price", "3500", Field.Store.YES,
>                                        Field.Index.TOKENIZED));
>
>
> its done properly.
>
> when i go for search am using
>
>                IndexSearcher searcher = new IndexSearcher(indexDir);
>
>                Analyzer analyzer = new StandardAnalyzer();
>
>                QueryParser parser = new QueryParser("contents", analyzer);
>                Query query = parser.parse(qryStr);
>
>                Hits hits = searcher.search(query);
>
> and my query is to search is price:[1000 TO 4000]. when i search this, it
> returns nothing or when i change the query to price:[2000 TO 4000] it
> return
> all hits. where am wrong.. am not getting any correct output. could any1
> help me out of this. please....
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message