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");
searcher.search(query, collector);
ScoreDoc[] hits = collector.topDocs().scoreDocs;
Document doc = searcher.doc(hits[i].doc);
2)
Sort sort = new Sort(fieldName,true);
QueryParser parser = new QueryParser(fieldName, analyzer); query =
parser.parse("keyword");
TopFieldDocs tfd = searcher.search(query,null,50,sort);
hits = tfd.scoreDocs;
Document doc = searcher.doc(hits[i].doc);
In that case, what is the difference with between ScoreDoc[] hits =
collector.topDocs().scoreDocs
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..
thanks.
Jang.
--
DEV용식
http://devyongsik.tistory.com