[
https://issues.apache.org/jira/browse/LUCENE-4896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13630411#comment-13630411
]
Robert Muir commented on LUCENE-4896:
-------------------------------------
Patch looks good... I'm going to apply it and review one last time. Thanks Luca!
Just to try to explain my reasoning again for the abstract class: in general to
me if its the class's "primary purpose" then its the correct way from an
inheritance perspective. Whereas interfaces (e.g. Closeable) are not. This way
we get the possibility of incorporating default behavior and things like this.
One reason why this could be useful, when we look at issues like LUCENE-4906,
we might want to make formatter more powerful to do this: maybe it has a
lower-level method that e.g. gets docids and all kinds of other things, or even
all the passages for all the top-docs. The default implementation could still
call format() for each doc, but that would allow someone to e.g. build a
complex response structure for the whole top-docs at once or something like
that.
I'm not arguing that would necessarily be a good API at all, its just a
theoretical example that wouldnt work well with interfaces :)
> PostingsHighlighter should use a interface of PassageFormatter instead of a
> class
> ---------------------------------------------------------------------------------
>
> Key: LUCENE-4896
> URL: https://issues.apache.org/jira/browse/LUCENE-4896
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/highlighter
> Affects Versions: 4.2
> Environment: NA
> Reporter: Sebastien Dionne
> Labels: newdev
> Attachments: LUCENE-4896.patch, LUCENE-4896.patch, LUCENE-4896.patch
>
>
> In my project I need a custom PassageFormatter to use with
> PostingsHighlighter. I extended PassageFormatter to override format(...)
> but if I do that, I don't have access to the private variables. So instead
> of changing the scope to protected, it should be more usefull to use a
> interface for PassageFormatter.
> like public DefaultPassageFormatter implements PassageFormatter.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]