Commit f7416aac by zhaoyanchao

删除掉排序,看是否能保持高分在前

parent 5426a5ed
...@@ -51,14 +51,7 @@ public abstract class QueryRescorer extends Rescorer { ...@@ -51,14 +51,7 @@ public abstract class QueryRescorer extends Rescorer {
@Override @Override
public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN) throws IOException { public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN) throws IOException {
ScoreDoc[] hits = firstPassTopDocs.scoreDocs.clone(); ScoreDoc[] hits = firstPassTopDocs.scoreDocs.clone();
Arrays.sort(hits,
new Comparator<ScoreDoc>() {
@Override
public int compare(ScoreDoc a, ScoreDoc b) {
return Float.compare(b.score,a.score);
}
});
List<LeafReaderContext> leaves = searcher.getIndexReader().leaves(); List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
Weight weight = searcher.createNormalizedWeight(query, true); Weight weight = searcher.createNormalizedWeight(query, true);
...@@ -93,7 +86,7 @@ public abstract class QueryRescorer extends Rescorer { ...@@ -93,7 +86,7 @@ public abstract class QueryRescorer extends Rescorer {
if (actualDoc < targetDoc) { if (actualDoc < targetDoc) {
actualDoc = scorer.iterator().advance(targetDoc); actualDoc = scorer.iterator().advance(targetDoc);
} }
if (actualDoc == targetDoc) { if (actualDoc == targetDoc) {
// Query did match this doc: // Query did match this doc:
hit.score = combine(hit.score, true, scorer.score()); hit.score = combine(hit.score, true, scorer.score());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment