lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G.Long" <>
Subject Re: how to create a range query with string parameters
Date Tue, 17 May 2011 14:41:09 GMT
Hi Uwe :)

Thank you for your answer ! Now I have another problem. Here is the code 
I use to query the index :

ScoreDoc[] hits = null;
         TopFieldCollector collector = TopFieldCollector.create(new 
Sort(SortField.FIELD_DOC), 200000, true, false, false, false);
         Directory directory = 

         IndexSearcher isearcher = new IndexSearcher(directory);
         Query tQueryCode = new TermQuery(new Term(FIELD_CODE, "CCOM"));
         Query tQueryCodeRef = new TermQuery(new Term(FIELD_CODE_REF, 
         Query rQuery = new TermRangeQuery(FIELD_ARTICLE, "l110-1", 
"l146-4", true, true);

         BooleanQuery bQuery = new BooleanQuery();
         bQuery.add(tQueryCode, Occur.MUST);
         bQuery.add(tQueryCodeRef, Occur.MUST);
         bQuery.add(rQuery, Occur.MUST);

, collector);
         hits = collector.topDocs().scoreDocs;


The query is : +code:CCOM +codeRef:CCOM +article:[l110-1 TO l146-4]

The hits[] is equal to Zero although there should be hits. I'm using a 
program called lukeall 3.1 which provide
a GUI to query a lucene index. When I copy the query into this program 
and run it, it return a lot of results =o

So I guess I'm missing something. I thought about a missing analyzer but 
I'm not sure...


Le 17/05/2011 14:02, Uwe Schindler a écrit :
> Hi,
> Query q = new TermRangeQuery(...)
> Uwe
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> eMail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message