diff --git a/CHANGES.txt b/CHANGES.txt index c44598b771d..53875fe9b0a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -503,8 +503,8 @@ Bug Fixes 45. SOLR-1078: Fixes to WordDelimiterFilter to avoid splitting or dropping international non-letter characters such as non spacing marks. (yonik) -46. SOLR-825: Enables highlighting for range/wildcard/fuzzy/prefix queries if using hl.usePhraseHighlighter=true - and hl.highlightMultiTerm=true. (Mark Miller) +46. SOLR-825, SOLR-1221: Enables highlighting for range/wildcard/fuzzy/prefix queries if using hl.usePhraseHighlighter=true + and hl.highlightMultiTerm=true. Also make both options default to true. (Mark Miller) 47. SOLR-1174: Fix Logging admin form submit url for multicore. (Jacob Singh via shalin) diff --git a/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java b/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java index 594876f6ff8..02d8e7c90c1 100644 --- a/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java +++ b/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java @@ -144,7 +144,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf */ private QueryScorer getSpanQueryScorer(Query query, String fieldName, TokenStream tokenStream, SolrQueryRequest request) throws IOException { boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false); - Boolean highlightMultiTerm = request.getParams().getBool(HighlightParams.HIGHLIGHT_MULTI_TERM); + Boolean highlightMultiTerm = request.getParams().getBool(HighlightParams.HIGHLIGHT_MULTI_TERM, true); if(highlightMultiTerm == null) { highlightMultiTerm = false; } @@ -306,8 +306,9 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf } Highlighter highlighter; - if (Boolean.valueOf(req.getParams().get(HighlightParams.USE_PHRASE_HIGHLIGHTER))) { - // wrap CachingTokenFilter around TokenStream for reuse + if (Boolean.valueOf(req.getParams().get(HighlightParams.USE_PHRASE_HIGHLIGHTER, "true"))) { + // TODO: this is not always necessary - eventually we would like to avoid this wrap + // when it is not needed. tstream = new CachingTokenFilter(tstream); // get highlighter diff --git a/src/test/org/apache/solr/highlight/HighlighterTest.java b/src/test/org/apache/solr/highlight/HighlighterTest.java index baeb8a215ad..baa1d1ef1c6 100755 --- a/src/test/org/apache/solr/highlight/HighlighterTest.java +++ b/src/test/org/apache/solr/highlight/HighlighterTest.java @@ -585,6 +585,7 @@ public class HighlighterTest extends AbstractSolrTestCase { args.put("hl.fl", "t_text"); args.put("hl.fragsize", "40"); args.put("hl.snippets", "10"); + args.put("hl.usePhraseHighlighter", "false"); TestHarness.LocalRequestFactory sumLRF = h.getRequestFactory( "standard", 0, 200, args);