[ 
https://issues.apache.org/jira/browse/LUCENE-7844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16023374#comment-16023374
 ] 

David Smiley commented on LUCENE-7844:
--------------------------------------

{{int maxPassages}} (the parameter) does not override 
{{maxPassageCount(field)}} (the override-able method); it's the other way 
around.

We _could_ remove maxPassages as an argument and instead require that 
{{maxPassageCount(field)}} is overridden (defaulting to 1) but I believe that 
setting maxPassages to other than 1 isn't so rare -- your suggestion would make 
it awkward (force subclassing). On the other hand, it would lead to additional 
API simplifications (fewer overloads).  We agree 1 is definitely the most 
typical value.  What I definitely think is rare is having the maxPassage vary 
per field, hence my motivation behind this patch.  

> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to