lucene4: org.apache.lucene.search.vectorhighlight package cleanup

This commit is contained in:
Igor Motov 2012-10-30 21:12:19 -04:00 committed by Shay Banon
parent 639b1323b8
commit e8092fe290
3 changed files with 10 additions and 9 deletions

View File

@ -86,6 +86,9 @@ public class XTermsFilter extends Filter {
length = index;
}
public Term[] getTerms() {
return filterTerms;
}
@Override
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs) throws IOException {

View File

@ -144,7 +144,7 @@ public abstract class AbstractFragmentsBuilder extends BaseFragmentsBuilder {
}
}
if (!toffsList.isEmpty()) {
subInfos.add(new FieldFragList.WeightedFragInfo.SubInfo(subInfo.text, toffsList, subInfo.getSeqnum()));
subInfos.add(new FieldFragList.WeightedFragInfo.SubInfo(subInfo.getText(), toffsList, subInfo.getSeqnum()));
}
if (subInfo.getTermsOffsets().isEmpty()) {
@ -175,9 +175,7 @@ public abstract class AbstractFragmentsBuilder extends BaseFragmentsBuilder {
private final static List<FieldPhraseList.WeightedPhraseInfo> EMPTY = Collections.emptyList();
private WeightedFragInfo(int startOffset, int endOffset, float totalBoost, List<FieldFragList.WeightedFragInfo.SubInfo> subInfos) {
super(startOffset, endOffset, EMPTY);
this.subInfos = subInfos;
this.totalBoost = totalBoost;
super(startOffset, endOffset, subInfos, totalBoost);
}
}

View File

@ -65,12 +65,12 @@ public class XScoreOrderFragmentsBuilder extends AbstractFragmentsBuilder {
public static class ScoreComparator implements Comparator<WeightedFragInfo> {
public int compare(WeightedFragInfo o1, WeightedFragInfo o2) {
if (o1.totalBoost > o2.totalBoost) return -1;
else if (o1.totalBoost < o2.totalBoost) return 1;
if (o1.getTotalBoost() > o2.getTotalBoost()) return -1;
else if (o1.getTotalBoost() < o2.getTotalBoost()) return 1;
// if same score then check startOffset
else {
if (o1.startOffset < o2.startOffset) return -1;
else if (o1.startOffset > o2.startOffset) return 1;
if (o1.getStartOffset() < o2.getStartOffset()) return -1;
else if (o1.getStartOffset() > o2.getStartOffset()) return 1;
}
return 0;
}