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

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

Great example!  I was playing around with TestExitableDirectoryReader and 
there's definitely a loss of passing the term state.  I set a breakpoint here 
[https://github.com/apache/lucene-solr/blob/master/lucene/core/src/java/org/apache/lucene/search/TermQuery.java#L136]
 then ran in a debugger (after increasing the test timeout and removing the 
Ignore annotation) then stepped in to the default implementation of 
seekExact(term,state) for TestTermsEnum – which doesn't delegate.  I manually 
added delegation of this method there.  Then _again_ ran into the default 
implementation for ExtiableDirectoryReader's ExitableTermsEnum.  In this one 
little adventure, I his this thing twice.

_There's certainly a bug here_.  Either FilterTermsEnum should delegate 
everything, or these two subclasses of TermsEnum mentioned above ought to 
delegate these methods but I bet there are more out there if we look closer.  I 
appreciate modifying the delegation policy of FilterTermsEnum is not a decision 
to be taken lightly and would probably not happen until a major release.

> 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