lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Boss <na...@web.de>
Subject Lucene memory usage
Date Wed, 10 Jun 2009 12:23:47 GMT
Hej hej,

i have a question regarding lucenes memory usage
when launching a query. When i execute my query
lucene eats up over 1gig of heap-memory even 
when my result-set is only a single hit. I
found out that this is due to the "ensureIndexIsRead()" 
method-call in the "TermInfosReader" class, which
iterates over all Terms found in the index and saves
them (including all value-strings) in a Term-Array. 
Is it possible to not read all that stuff 
into memory at all?

Im doing the query like in the following pseudo-code:
------------------------------------------------------------------------

TopScoreDocCollector collector = new TopScoreDocCollector(100000);

QueryParser   parser= new QueryParser(field, new WhitespaceAnalyzer() );
Directory     fsDir = new FSDirectory(indexDir, null);
IndexSearcher is    = new IndexSearcher(fsdir);

Query         query = parser.parse(q);

is.search(query, collector);
ScoreDoc[] hits = collector.topDocs();

....... < iterate over hits and print results >


Thanks in advance
Benedikt

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