You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2017/05/24 03:53:04 UTC
[jira] [Updated] (LUCENE-7844) UnifiedHighlighter: simplify
"maxPassages" input API
[ https://issues.apache.org/jira/browse/LUCENE-7844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Smiley updated LUCENE-7844:
---------------------------------
Attachment: LUCENE_7844__UH_maxPassages_simplification.patch
Here's a patch. In addition to the primary issue at hand, I also:
* cleaned up some obsolete javadocs inherited from the PostingsHighlighter lineage that no longer apply
* refactored FieldHighlighter.highlightOffsetsEnums a little to use Java 8 features related to Comparators & lambdas to save some needless LOC.
* code style: many copy-pasted tests declared {{String snippets[]}} instead of {{String[] snippets}}
Perhaps you want to see [~jimczi] or [~Timothy055] ?
Suggested CHANGES.txt under API changes
* Changed UnifiedHighlighter.highlightFields methods which take an array of maxPassage integers by field to instead take a single int. To vary per field, override UH.getMaxPassageCount(String field).
> UnifiedHighlighter: simplify "maxPassages" input API
> ----------------------------------------------------
>
> Key: LUCENE-7844
> URL: https://issues.apache.org/jira/browse/LUCENE-7844
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/highlighter
> Reporter: David Smiley
> Priority: Minor
> Fix For: master (7.0)
>
> Attachments: LUCENE_7844__UH_maxPassages_simplification.patch
>
>
> The "maxPassages" input to the UnifiedHighlighter can be provided as an array to some of the public methods on UnifiedHighlighter. When it's provided as an array, the index in the array is for the field in a parallel array. I think this is awkward and furthermore it's inconsistent with the way this highlighter customizes things on a by field basis. Instead, the parameter can be a simple int default (not an array), and then there can be a protected method like {{getMaxPassageCount(String field}} that returns an Integer which, when non-null, replaces the default value for this field.
> Aside from API simplicity and consistency, this will also remove some annoying parallel array sorting going on.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org