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

David Smiley commented on LUCENE-8292:
--------------------------------------

_Any_ use of a delegating wrapper is arguably "trappy" in the sense that you 
need to be mindful of what you should and should not override to do whatever it 
is you are doing.  So I think we might as well delegate everything – at least 
at the time of creating the subclass you can look at the FilterTermsEnum and 
observe the methods to potentially override yourself.  Today you need to know 
there are some "hidden" ones further below in the hierarchy.

Sidenote: if we were all using Kotlin, we probably would not bother to have 
such Filter/delegate classes in Lucene because Kotlin [makes it trivial to 
auto-delegate all 
members|https://kotlinlang.org/docs/reference/delegation.html].  You still need 
to be mindful of what you need to override to do whatever it is you need to do.

> Fix FilterLeafReader.FilterTermsEnum to delegate all seekExact methods
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-8292
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8292
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 7.2.1
>            Reporter: Bruno Roustant
>            Priority: Major
>             Fix For: trunk
>
>         Attachments: 
> 0001-Fix-FilterLeafReader.FilterTermsEnum-to-delegate-see.patch, 
> LUCENE-8292.patch
>
>
> FilterLeafReader#FilterTermsEnum wraps another TermsEnum and delegates many 
> methods.
> It misses some seekExact() methods, thus it is not possible to the delegate 
> to override these methods to have specific behavior (unlike the TermsEnum API 
> which allows that).
> The fix is straightforward: simply override these seekExact() methods and 
> delegate.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to