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

Michael McCandless commented on LUCENE-1558:
--------------------------------------------

bq. Personally, I'm not so sure its a bad idea making the user specify as it is 
now

The thing is, I expect the vast majority of users use readOnly=true, and to 
those users they would be baffled that IndexReader even has a readOnly=false 
possibility.  "Simple things should be simple".  Also, the exception that's 
thrown if you attempt a write operation against a readOnly reader is pretty 
darned clear about what's gone wrong:

    throw new UnsupportedOperationException("This IndexReader cannot make any 
changes to the index (it was opened with readOnly = true)");

(We can reword it to say something like "You must open the IndexReader with 
readOnly=false to make changes" or some such).

In other cases, I would agree we should force sneaky parameters to be explicit 
on construction, so users think about the choice.  EG we did this with 
maxFieldLength to IndexWriter, because in that case the truncation was silent, 
actually resulted in losing indexed content,  and we saw from our user's that 
it tripped people up far too often.  But I don't think this case fits that same 
pattern...

> Make IndexReader/Searcher ctors readOnly=true by default
> --------------------------------------------------------
>
>                 Key: LUCENE-1558
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1558
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.4.1
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.0
>
>
> Another "change the defaults" in 3.0.
> Right now you get a read/write reader from IndexReader.open and new 
> IndexSearcher(...), and reserving the right to write causes thread contention 
> (on isDeleted).
> In 3.0 let's make readOnly reader the default, but still allow opening a 
> read/write IndexReader.

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