From 5e5e5aa85a24ba6b689534e85be3b9cece241d13 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Sat, 14 Nov 2009 13:44:53 +0000 Subject: [PATCH] LUCENE-2064: Highlighter support all MultiTermQuery subclasses without explicit casts - previous commit did not contain final patch due to JIRA AM / PM issue git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@836176 13f79535-47bb-0310-9956-ffa450edef68 --- .../highlight/WeightedSpanTermExtractor.java | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) 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); } + } }