lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "장용석" <>
Subject about TopFieldDocs
Date Mon, 05 Jan 2009 08:45:37 GMT
Hi.. :)

I have a simple question..

I have two sample code.

1) TopDocCollector collector = new TopDocCollector(5 * hitsPerPage);
    QueryParser parser = new QueryParser(fieldName, analyzer);
    query = parser.parse("keyword");, collector);
    ScoreDoc[] hits = collector.topDocs().scoreDocs;
   Document doc = searcher.doc(hits[i].doc);

Sort sort = new Sort(fieldName,true);
QueryParser parser = new QueryParser(fieldName, analyzer); query =
TopFieldDocs tfd =,null,50,sort);

hits = tfd.scoreDocs;
Document doc = searcher.doc(hits[i].doc);

In that case, what is the difference with between ScoreDoc[] hits =
and ScoreDoc[] hits = tfd.scoreDocs?

and.. in case 2)
It did throw exception java.lang.OutOfMemoryError: Java heap space.
I did not set jvm option and my index size is about 1G.
and after search collector.getTotalHits() is 2585.

I thins 2585 is not many documents....

What do i do for fix this problem? just increase jvm heap memory size? or
Is there other way?

I need some advice..:)

Sorry for my bad English..



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