mirror of https://github.com/apache/lucene.git
SOLR-5564: hl.maxAlternateFieldLength should apply to original field when fallback field does not exist
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1555035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1587e84b60
commit
ca5f42a14e
|
@ -197,7 +197,7 @@ Bug Fixes
|
|||
* SOLR-5577: Likely ZooKeeper expiration should not slow down updates a given
|
||||
amount, but instead cut off updates after a given time.
|
||||
(Mark Miller, Christine Poerschke)
|
||||
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
@ -335,6 +335,9 @@ Bug Fixes
|
|||
* SOLR-5588: PeerSync doesn't count all connect failures as success.
|
||||
(Mark Miller)
|
||||
|
||||
* SOLR-5564: hl.maxAlternateFieldLength should apply to original field when
|
||||
fallback is attempted (janhoy)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -602,6 +602,10 @@ public class DefaultSolrHighlighter extends SolrHighlighter implements PluginInf
|
|||
String alternateField = params.getFieldParam(fieldName, HighlightParams.ALTERNATE_FIELD);
|
||||
if (alternateField != null && alternateField.length() > 0) {
|
||||
StorableField[] docFields = doc.getFields(alternateField);
|
||||
if (docFields.length == 0) {
|
||||
// The alternate field did not exist, treat the original field as fallback instead
|
||||
docFields = doc.getFields(fieldName);
|
||||
}
|
||||
List<String> listFields = new ArrayList<String>();
|
||||
for (StorableField field : docFields) {
|
||||
if (field.binaryValue() == null)
|
||||
|
|
|
@ -660,6 +660,16 @@ public class HighlighterTest extends SolrTestCaseJ4 {
|
|||
"//lst[@name='highlighting']/lst[@name='1' and count(*)=1]",
|
||||
"//lst[@name='highlighting']/lst[@name='1']/arr[@name='t_text']/str[.='a piece of text']"
|
||||
);
|
||||
|
||||
// with a non-existing alternate field + max length
|
||||
args.put("hl.alternateField", "NonExistingField");
|
||||
args.put("hl.maxAlternateFieldLength", "15");
|
||||
sumLRF = h.getRequestFactory("standard", 0, 200, args);
|
||||
assertQ("Alternate summarization",
|
||||
sumLRF.makeRequest("tv_text:keyword"),
|
||||
"//lst[@name='highlighting']/lst[@name='1' and count(*)=1]",
|
||||
"//lst[@name='highlighting']/lst[@name='1']/arr[@name='t_text']/str[.='a piece of text']"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue