[ 
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

After porting Automaton, I realized, that the seeking code should be changed 
and made a little bit more flexible.

AcceptStatus can now return 5 stati:
- YES, NO: Accept / not accept the term and go forward, the simple linear case 
that iterates until the end and filters terms (FuzzyQuery case, linear 
Automaton)
- YES_AND_SEEK, NO_AND_SEEK: the same like above, but instead of simply going 
forward, nextSeekTerm() is called to retrieve a new term to seek to. This 
method is now supposed to always return a greater term than before, if not, the 
enumeration can end too early (see below).
- END: end the enumeration, so seeking. This status is used by TermRangeQuery 
and PrefixQuery as before.

nextSeekTerm() should always return a greater term that the last one before 
seeking. This is asserted by NRQ. It is not bad to do this, but after that the 
enum is no longer correctly sorted. Also, if the consumer reaches the last term 
of the underlying enum, call next() will end enumeration and so further terms 
in the nextSeekTerm() interation will not consulted (the same happens when END 
is returned in accept, of course).

If nextSeekTerm() returns null, the enumeration is also ended, so it is not 
required to return AcceptStatus.END instead of X_AND_SEEK.

> 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
>            Assignee: Uwe Schindler
>             Fix For: Flex Branch
>
>         Attachments: LUCENE-2110.patch, LUCENE-2110.patch, LUCENE-2110.patch, 
> 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