Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E82AFDDA5 for ; Mon, 17 Sep 2012 20:27:08 +0000 (UTC) Received: (qmail 86555 invoked by uid 500); 17 Sep 2012 20:27:07 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 86412 invoked by uid 500); 17 Sep 2012 20:27:07 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 86405 invoked by uid 99); 17 Sep 2012 20:27:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2012 20:27:07 +0000 Date: Tue, 18 Sep 2012 07:27:07 +1100 (NCT) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: <1515710384.89445.1347913627709.JavaMail.jiratomcat@arcas> In-Reply-To: <86641461.89430.1347913507942.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (LUCENE-4403) sharpen javadocs for DISI.docID() when unpositioned MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-4403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robert Muir updated LUCENE-4403: -------------------------------- Attachment: LUCENE-4403.patch start to a patch. As i said the javadocs are ambiguous, an unpositioned DocsEnum can return NO_MORE_DOCS, but you also shouldnt nextDoc() after you see this. Because of the ambiguity I'm sure we have test bugs: would be good to have a test postings-format that "caches" (reads ahead or something) to sometimes do this and tickle them out. > sharpen javadocs for DISI.docID() when unpositioned > --------------------------------------------------- > > Key: LUCENE-4403 > URL: https://issues.apache.org/jira/browse/LUCENE-4403 > Project: Lucene - Core > Issue Type: Bug > Reporter: Robert Muir > Attachments: LUCENE-4403.patch > > > Spinoff from LUCENE-4401. > Currently DISI requires an unpositioned iterator to be -1 or NO_MORE_DOCS. But I think we should refine this: in my opinion NO_MORE_DOCS should mean NO_MORE_DOCS. > So its ok for it to return NO_MORE_DOCS when its unpositioned, but only if it can already determine that its exhausted. > This makes life easier on consumers. > {quote} > Separately we cant really test this situation very well as long as the javadocs for nextDoc say, Returns the following: > -1 or NO_MORE_DOCS if nextDoc() or > advance(int) were not called yet. > NO_MORE_DOCS if the iterator has exhausted. > Otherwise it should return the doc ID it is currently on. > This prevents us from being able to easily assert that nobody is calling nextDoc()/advance() after the enum is exhausted, since we cannot differentiate 'exhausted' from 'uninitialized'. > I think we should clarify the javadocs, such that if nextDoc()/advance() are not called yet, you can still return NO_MORE_DOCS, but only if you somehow know you are exhausted-before-you-start. NO_MORE_DOCS should mean NO_MORE_DOCS. > It could also be everyone reads it this way already, and I'm just being super-anal. > {quote} > {quote} > +1 to sharpen when a DocsEnum can return NO_MORE_DOCS before nextDoc: it should only be if the enum knows it has zero docs. But I'm not even sure we should allow that ... why not always make it -1 ...? We can do that separately... > {quote} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org