[ 
https://issues.apache.org/jira/browse/LUCENE-2110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-2110:
----------------------------------

    Attachment: LUCENE-2110.patch

Here my patch for this.

I rewrote the whole FilteredTermsEnum and made it natively support seeking 
needed for NRQ and Automaton.

This initial patch is for review only, but all tests pass. I will try to modify 
Robert's patch, as soon as he provided me an updated Patch for Automaton flex 
branch.

The enum works different than before:
It is positioned before the first term (like it should), seeking is no longer 
supported (as not needed for MTQ) and not implementable for seeking enums like 
NRQ or Automaton.

In the constructor you give index reader and field name, as TermsEnum can only 
iterate one field in flex, this is no limitation.

For non-seeking enums you can set the initial term to seek to with 
setInitialSeekTerm(TermRef) in the ctor. The rest of the enum then behaves as 
before.

For seeking enums like Automaton/NRQ you override a secondary iterator method 
nextSeekTerm() that returns the next TermRef the underlying iterator should 
seek to. This method is called, when accept() returns END (and also on the 
first next() call, of course). The default impl of this method just returns the 
initial seek term as explained above one time and then null.

Everything else stands in the javadocs.

> Change FilteredTermsEnum to work like Iterator, so it is not positioned and 
> next() must be always called first. Remove empty()
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2110
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2110
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>    Affects Versions: Flex Branch
>            Reporter: Uwe Schindler
>             Fix For: Flex Branch
>
>         Attachments: LUCENE-2110.patch
>
>
> FilteredTermsEnum is confusing as it is initially positioned to the first 
> term. It should instead work like an uninitialized TermsEnum for a field 
> before the first call to next() or seek().
> Also document that not all FilteredTermsEnums may implement seek() as eg. NRQ 
> or Automaton are not able to support this. Seeking is also not needed for MTQ 
> at all, so seek can just throw UOE.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to