lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Causse <dcau...@spotter.com>
Subject Re: FieldSelector with Lucene 2.3.2
Date Thu, 17 Mar 2011 11:22:25 GMT
On Wed, Mar 16, 2011 at 03:17:41PM +0000, Chris Bamford wrote:
> Hi
> 
> I am trying to speed up access to the data in my results Documents
> and was wondering if FieldSelector might be the way forward?
> After my search, I end up with an ArrayList of Documents, from each
> of which I need to extract certain fields and their values as
> key/value pairs in a HashMap.   Normally this is quick, but with
> large data sets (10,000+) it can take several seconds.  Here is the
> essence of the current code:
> 
>             for (Document doc : resultDocs) {
>                 keyVals = getDocKeyValuePairs(doc, fields);
>                 if (keyVals != null) {
>                     resultsList.add(keyVals);
>                 }
>             }

Hi, 
at this point it's too late, the field selector must be applied when you
fill resultDocs and call IndexReder.document(int id, FieldSelector fs) or
Searcher.doc(int id, FieldSelector fs).

Another point is that your code is too close from the dataset volume,
more doc means more heap. If you don't need yo have the whole dataset
loaded into RAM maybe you could implement a custom Collector that do the
whole job on a doc by doc basis and not collecting and saving all docs
in a Collection.

-- 
David Causse
Spotter
http://www.spotter.com/

---------------------------------------------------------------------
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