[
https://issues.apache.org/jira/browse/LUCENE-6226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14314108#comment-14314108
]
Alan Woodward commented on LUCENE-6226:
---------------------------------------
OK, let's set aside offsets and payloads for this issue.
My initial idea in LUCENE-2878 was for nextPosition() to return
NO_MORE_POSITIONS (defined as -1) when it's exhausted. So if you request
positions from a Scorer that doesn't support them at all, it can just return
NO_MORE_POSITIONS immediately. Clients know that to iterate through a Scorer's
positions, you do:
{code}
int pos;
while ((pos = scorer.nextPosition()) != NO_MORE_POSITIONS) {
// do stuff
}
{code}
And this way Scorers that don't support positions (or that don't make sense to
return them) are dealt with naturally.
> Allow TermScorer to expose positions, offsets and payloads
> ----------------------------------------------------------
>
> Key: LUCENE-6226
> URL: https://issues.apache.org/jira/browse/LUCENE-6226
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Alan Woodward
> Assignee: Alan Woodward
> Fix For: Trunk, 5.1
>
> Attachments: LUCENE-6226.patch, LUCENE-6226.patch, LUCENE-6226.patch,
> LUCENE-6226.patch, LUCENE-6226.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]