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

Uwe Schindler commented on LUCENE-2386:
---------------------------------------

Thanks Earwin, thats exactly my opinion, too. For me the whole behaviour is 
defined and correct. The create param in the ctor is just an initialization of 
the directory to be a defined index (empty at the beginning).

Maybe we should remove the create param from IndexWriter ctor/config at all, 
and just define a static utility method in IW, that "initializes" an empty 
directory. The standard ctors in IW then should thow IndexNotFound if the 
directory is not yet initialized. This way, we dont need those strange create 
params.

> IndexWriter commits unnecessarily on fresh Directory
> ----------------------------------------------------
>
>                 Key: LUCENE-2386
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2386
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>             Fix For: 3.1
>
>         Attachments: LUCENE-2386.patch, LUCENE-2386.patch, LUCENE-2386.patch, 
> LUCENE-2386.patch, LUCENE-2386.patch
>
>
> I've noticed IndexWriter's ctor commits a first commit (empty one) if a fresh 
> Directory is passed, w/ OpenMode.CREATE or CREATE_OR_APPEND. This seems 
> unnecessarily, and kind of brings back an autoCommit mode, in a strange way 
> ... why do we need that commit? Do we really expect people to open an 
> IndexReader on an empty Directory which they just passed to an IW w/ 
> create=true? If they want, they can simply call commit() right away on the IW 
> they created.
> I ran into this when writing a test which committed N times, then compared 
> the number of commits (via IndexReader.listCommits) and was surprised to see 
> N+1 commits.
> Tried to change doCommit to false in IW ctor, but it got IndexFileDeleter 
> jumping on me .. so the change might not be that simple. But I think it's 
> manageable, so I'll try to attack it (and IFD specifically !) back :).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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