[
https://issues.apache.org/jira/browse/SOLR-8583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jan Høydahl updated SOLR-8583:
------------------------------
Attachment: SOLR-8583.patch
New patch incorporating [~dsmiley]'s comments more or less:
* Went back to swapping {{req.params}} with a wrapDefaults version.
* New method {{doHighlightingOfField()}} which gets rid of duplication of code
* Lazy FVH init by passing around new inner class FvhContainer with members
{{fvh}} and {{fieldQuery}} which can then be altered by methods
* Moved highlighting of alternate into method {{alternateField()}} to gather
all logic in same place
* FIeldname loop now looks like this: {code}// Highlight per-field
for (String fieldName : fieldNames) {
SchemaField schemaField = schema.getFieldOrNull(fieldName);
Object fieldHighlights; // object type allows flexibility for subclassers
fieldHighlights = doHighlightingOfField(schemaField, params, fvhContainer,
doc, docId, query, reader, req);
if (fieldHighlights == null) {
fieldHighlights = alternateField(doc, fieldName, req, docId, query, reader,
schema, fvhContainer);
}
if (fieldHighlights != null) {
docHighlights.add(fieldName, fieldHighlights);
}
} // for each field
{code}
What puzzles me is that the changes should be pure code structure, no
functionality change, yet one of the tests started failing. It was the first
test of {{testAlternateSummaryWithHighlighting()}} setting
maxAlternateFieldLength=18. Earlier it returned
{{<simplepre>keyword</simplepost> is only here}}, but with the last patch I had
to change it into {{<simplepre>keyword</simplepost> is only}}.
Currently I'm not able to debug tests in my IntelliJ 16, so I just changed the
assert instead of digging further.
> Apply highlighting to hl.alternateField
> ---------------------------------------
>
> Key: SOLR-8583
> URL: https://issues.apache.org/jira/browse/SOLR-8583
> Project: Solr
> Issue Type: Improvement
> Components: highlighter
> Affects Versions: 5.4
> Reporter: Jan Høydahl
> Assignee: Jan Høydahl
> Fix For: 6.1
>
> Attachments: SOLR-8583.patch, SOLR-8583.patch, SOLR-8583.patch
>
>
> Today, you can configure hl.alternateField for highlighter to display if no
> snippets were produced from original field. But the contents of the fallback
> field is output without highlighting the original query terms.
> This issue will cause alternate field to be highlighted with no snippet
> generation, and still respect max length. You can turn it off using new param
> {{hl.highlightAlternate=false}}. Supported highlighters: Simple, FVH
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]