SOLR-1221: Change Solr Highlighting to use the SpanScorer with MultiTerm expansion by default

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@819314 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-09-27 13:58:30 +00:00
parent 94df351b87
commit d65d0553db
3 changed files with 7 additions and 5 deletions

View File

@ -503,8 +503,8 @@ Bug Fixes
45. SOLR-1078: Fixes to WordDelimiterFilter to avoid splitting or dropping 45. SOLR-1078: Fixes to WordDelimiterFilter to avoid splitting or dropping
international non-letter characters such as non spacing marks. (yonik) 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 46. SOLR-825, SOLR-1221: Enables highlighting for range/wildcard/fuzzy/prefix queries if using hl.usePhraseHighlighter=true
and hl.highlightMultiTerm=true. (Mark Miller) 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) 47. SOLR-1174: Fix Logging admin form submit url for multicore. (Jacob Singh via shalin)

View File

@ -144,7 +144,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
*/ */
private QueryScorer getSpanQueryScorer(Query query, String fieldName, TokenStream tokenStream, SolrQueryRequest request) throws IOException { private QueryScorer getSpanQueryScorer(Query query, String fieldName, TokenStream tokenStream, SolrQueryRequest request) throws IOException {
boolean reqFieldMatch = request.getParams().getFieldBool(fieldName, HighlightParams.FIELD_MATCH, false); 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) { if(highlightMultiTerm == null) {
highlightMultiTerm = false; highlightMultiTerm = false;
} }
@ -306,8 +306,9 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
} }
Highlighter highlighter; Highlighter highlighter;
if (Boolean.valueOf(req.getParams().get(HighlightParams.USE_PHRASE_HIGHLIGHTER))) { if (Boolean.valueOf(req.getParams().get(HighlightParams.USE_PHRASE_HIGHLIGHTER, "true"))) {
// wrap CachingTokenFilter around TokenStream for reuse // TODO: this is not always necessary - eventually we would like to avoid this wrap
// when it is not needed.
tstream = new CachingTokenFilter(tstream); tstream = new CachingTokenFilter(tstream);
// get highlighter // get highlighter

View File

@ -585,6 +585,7 @@ public class HighlighterTest extends AbstractSolrTestCase {
args.put("hl.fl", "t_text"); args.put("hl.fl", "t_text");
args.put("hl.fragsize", "40"); args.put("hl.fragsize", "40");
args.put("hl.snippets", "10"); args.put("hl.snippets", "10");
args.put("hl.usePhraseHighlighter", "false");
TestHarness.LocalRequestFactory sumLRF = h.getRequestFactory( TestHarness.LocalRequestFactory sumLRF = h.getRequestFactory(
"standard", 0, 200, args); "standard", 0, 200, args);