You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Smiley (JIRA)" <ji...@apache.org> on 2018/02/26 19:46:00 UTC

[jira] [Commented] (LUCENE-6271) PostingsEnum should have consistent flags behavior

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

David Smiley commented on LUCENE-6271:
--------------------------------------

I think in this issue we forgot to update the javadocs of org.apache.lucene.index.TermsEnum#postings(org.apache.lucene.index.PostingsEnum, int) to remove mention of null being a valid return; it should be flipped to say it isn't valid, just like the overloaded one without the flags says.  For a while I thought it was valid and I kept guarding against it and in one case wrote some ugly loop that downgrades bits until non-null.  I don't believe it happened in practice but the docs allowed it so...

[~rjernst] If you don't want to do it or are too busy, I could simply update the javadocs on master & 7x.
CC [~romseygeek] as LUCENE-4524 was highly related and was the commit that actually has the current javadocs about null being permitted.

> PostingsEnum should have consistent flags behavior
> --------------------------------------------------
>
>                 Key: LUCENE-6271
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6271
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Ryan Ernst
>            Assignee: Robert Muir
>            Priority: Major
>             Fix For: 5.1
>
>         Attachments: LUCENE-6271.patch, LUCENE-6271.patch
>
>
> When asking for flags like OFFSETS or PAYLOADS with DocsAndPositionsEnum, the behavior was to always return an enum, even if offsets or payloads were not indexed.  They would just not be available from the enum if they were not present.  This behavior was carried over to PostingsEnum, which is good.
> However, the new POSITIONS flag has different behavior.  If positions are not available, null is returned, instead of a PostingsEnum that just gives access to freqs.  This behavior is confusing, as it means you have to special case asking for positions (only ask if you know they were indexed) which sort of defeats the purpose of the unified PostingsEnum.
> We should make POSITIONS have the same behavior as other flags. The trickiest part will be maintaining backcompat for DocsAndPositionsEnum in 5.x, but I think it can be done.



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

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