Skip to content

Apache Lucene open-source search software

LUCENE-2064: Highlighter support all MultiTermQuery subclasses without explicit casts - previous commit did not contain final patch due to JIRA AM / PM issue

Simon Willnauer5e5e5aa85a24
diff --git a/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java b/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
index c6a1ad91f28..bdd6cf980f6 100644
--- a/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
+++ b/contrib/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java
@@ -567,31 +567,14 @@ public class WeightedSpanTermExtractor {
}
@Override
- public TermEnum terms(Term t) throws IOException {
- field = t.field();
- return new TermEnum() {
-
- @Override
- public Term term() {
- return null;
- }
-
- @Override
- public boolean next() throws IOException {
- return false;
- }
-
- @Override
- public int docFreq() {
- return 0;
- }
-
- @Override
- public void close() throws IOException {
- }
- };
+ public TermEnum terms(final Term t) throws IOException {
+ // only set first fieldname, maybe use a Set?
+ if (t != null && field == null)
+ field = t.field();
+ return super.terms(t);
}
+
}
}