lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Kabashnyuk" <>
Subject Hits.
Date Fri, 07 Mar 2008 10:26:14 GMT
I have a question about retrieving information.
Lets say I have an index which contents a millions of documents with 2-3  
small fields an a 10 large fields.
Then I run a query which returns me a 1000 of hits.  But I am interested  
only  one small field, and I don't want to load other fields.

Can I do something like what?

       int id =;

       FieldSelector fieldSelector = new FieldSelector() {
         public FieldSelectorResult accept(String fieldName) {
             return FieldSelectorResult.LOAD_AND_BREAK;
           return FieldSelectorResult.NO_LOAD;

       Document doc = reader.document(id, fieldSelector);
       if(doc == null)
         throw new IOException("Document with id "+id+" not found");
       return doc.get(field);

n from 0 to hits.length().

Best regards,

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

View raw message