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

Karl Wettin commented on LUCENE-2144:
-------------------------------------

I don't have any strong feelings about this line of code, but let me at least 
explain it.

I like the idea that IIFoo behaves the same way a SegementFoo, even during 
incorrect/undocumented use of the API. 

There are no real use cases for this in the Lucene distribution, there are 
however effects people might use even though caused by invalid use of the API 
and not recommened. E.g. a skipTo to a target greater than the greatest 
document associated with that term will position the enum at the greatest 
document number for that term. Even though I wouldn't do something like this 
others might. 

In this case, where an immediate #next() on IR#termDocs() is called, it's might 
look silly to compare the behaviour of II and Segment as it's such blatantly 
erroneous use of the API, but even I have been known to come up with some 
rather strange solution now and then when nobody else is looking.

One alternative is that  #next would produce an InvalidStateException or 
something instead of just accepting the call, but then there is of course the 
small extra cost associated with checking if the enum has been seeked yet and 
#next is a rather commonly used method.

> InstantiatedIndexReader does not handle #termDocs(null) correct (AllTermDocs)
> -----------------------------------------------------------------------------
>
>                 Key: LUCENE-2144
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2144
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/*
>    Affects Versions: 2.9, 2.9.1, 3.0
>            Reporter: Karl Wettin
>            Assignee: Michael McCandless
>            Priority: Critical
>         Attachments: LUCENE-2144-30.patch, LUCENE-2144.txt
>
>
> This patch contains core changes so someone else needs to commit it.
> Due to the incompatible #termDocs(null) behaviour at least MatchAllDocsQuery, 
> FieldCacheRangeFilter and ValueSourceQuery fails using II since 2.9.
> AllTermDocs now has a superclass, AbstractAllTermDocs that also 
> InstantiatedAllTermDocs extend.
> Also:
>  * II-tests made less plausable to pass on future incompatible changes to 
> TermDocs and TermEnum
>  * IITermDocs#skipTo and #next mimics the behaviour of document posisioning 
> from SegmentTermDocs#dito when returning false
>  * II now uses BitVector rather than sets for deleted documents

-- 
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