SOLR-6692: Highlighter NPE bugfix when highlight nonexistent field.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1673281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2015-04-13 21:11:40 +00:00
parent 0c32d78135
commit f295b3a890
1 changed files with 3 additions and 3 deletions

View File

@ -237,7 +237,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
* @param params The params controlling Highlighting
*/
protected int getMaxSnippets(String fieldName, SolrParams params) {
return params.getFieldInt(fieldName, HighlightParams.SNIPPETS,1);
return params.getFieldInt(fieldName, HighlightParams.SNIPPETS, 1);
}
/**
@ -298,7 +298,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
protected Fragmenter getFragmenter(String fieldName, SolrParams params)
{
String fmt = params.getFieldParam( fieldName, HighlightParams.FRAGMENTER );
SolrFragmenter frag = fragmenters.get( fmt );
SolrFragmenter frag = fragmenters.get(fmt);
if( frag == null ) {
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "Unknown fragmenter: "+fmt );
}
@ -450,7 +450,7 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
final int mvToExamine =
req.getParams().getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_EXAMINE,
schemaField.multiValued() ? Integer.MAX_VALUE : 1);
(schemaField != null && schemaField.multiValued()) ? Integer.MAX_VALUE : 1);
// Technically this is the max *fragments* (snippets), not max values:
int mvToMatch =
req.getParams().getFieldInt(fieldName, HighlightParams.MAX_MULTIVALUED_TO_MATCH, Integer.MAX_VALUE);