Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
4.0
-
None
-
win7 + JDK6.0
-
New
Description
i want group in lucene ,i find group demo for lucene 4.0 API,
this is my code:
Analyzer analyzer=new WhitespaceAnalyzer(Version.LUCENE_40);
DirectoryReader indexReader=DirectoryReader.open(FSDirectory.open(new File(indexDir)));
IndexSearcher isearcher = new IndexSearcher(indexReader);
GroupingSearch groupingSearch = new GroupingSearch("CsCode");
groupingSearch.setGroupSort(Sort.INDEXORDER);
groupingSearch.setFillSortFields(true);
if (true)
{ // Sets cache in MB groupingSearch.setCachingInMB(100.0, true); }if (true) {
groupingSearch.setAllGroups(true);
}
QueryParser parser = new QueryParser(Version.LUCENE_40, "OneBestText1", analyzer);
Query query = parser.parse("你好");
TopGroups<String> result = groupingSearch.search(isearcher, query, 0, 5000);
// Render groupsResult...
if (true)
the totalGroupCount always 0 but result.groups.length is 590.
i donot know why ,please help