lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kushal Dave <>
Subject Filter the search based on the subset of docids.
Date Mon, 05 Mar 2012 21:46:51 GMT
I have an ID field that contains about 100,000 unique ids. If I want to
query all records with ids [1-100], How should I be doing this?

I tried doing it the following way:
                        Query qry = new MultiFieldQueryParser( fields,
analyzer ).parse( query );
                        RangeFilter rf3=new RangeFilter("id","1", "100",
                        FilteredQuery fq3=new FilteredQuery(qry, rf3);

                        // Search and get number of hits
                        TopDocCollector collector = new TopDocCollector(
maxHits );
               fq3, collector );
As the id field is indexed lexicographically, 1 to 100 does not quite do
what it is supposed to include. and it only returns docs that fall in the
lexicographic range (1, 10, 100) instead of the range (1, 2, 3, ... 99, 100)

Also, at the time of indexing the id field is stored but not analyzed.
luceneDoc.add( new Field( "id", id, Field.Store.YES,
Field.Index.NOT_ANALYZED ) );

I am using the lucene-2.4.1 api.

I apologize if this was a trivial question and has been answered previously
(but I tried searching for it before posting here.)
Any help is greatly appreciated.


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