1.不带排序的方法
2.带排序的
3.
TopDocCollector collector = new TopDocCollector(100);
chinaMSearcher.search(query1,null,collector);
ScoreDoc[] cHits = collector.topDocs().scoreDocs;
Hits cHits = chinaMSearcher.search(query1, sort);
2.带排序的
Sort sort = new Sort(new SortField[]{new SortField("maxCpc",true),new SortField("RankIndex",true)});
ScoreDoc[] cHits = chinaMSearcher.search(query1,null,100,sort).scoreDocs;
3.
if (cHits.length > 0) {
Document doc = chinaMSearcher.doc(cHits[i++].doc);
float score = cHits[i].score;
}