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

Uwe Schindler commented on LUCENE-3606:
---------------------------------------

Mike,
I agree that this might affect some apps, but as I said in the introduction: I 
want to only do this for 4.0 aka Trunk, so we are free to break some strange 
internal never-documented behaviour. By changing from atomic to per-segment 
search in 2.9 we already broke lots of incorrectly implemented stuff in Lucene, 
and these "features" is far less often used than Filters tied to top-level 
IndexSearcher instead the IR passed to getDocIdSet().

Delete by doc id is dangerous and should be prevented. But you can still do 
this: Create a custom Filter and do the deletion work in 
getDocIdSet(IndexReader) and pass it as Query to IndexWriter using 
ConstantScoreFilter. Using the IndexReader passed to getDocIdSet() you can do 
any funny things on it, just to produce valid docIds. IW will take care of 
deleteing them after getDocIdSet() returns.

As Robert said, with FilterIndexReader you can also delete documents without 
delay (same like in contrib/misc: PKIndexSplitter, MultiPassIndexSplitter) by 
just overlaying another Bits. To make those hidden documents disappear on disk, 
too use the aproach decsribed before.

And of course, let's nuke my favourite hate-candidate: setNorms()
                
> Make IndexReader really read-only in Lucene 4.0
> -----------------------------------------------
>
>                 Key: LUCENE-3606
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3606
>             Project: Lucene - Java
>          Issue Type: Task
>          Components: core/index
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>
> As we change API completely in Lucene 4.0 we are also free to remove 
> read-write access and commits from IndexReader. This code is so hairy and 
> buggy (as investigated by Robert and Mike today) when you work on 
> SegmentReader level but forget to flush in the DirectoryReader, so its better 
> to really make IndexReaders readonly.
> Currently with IndexReader you can do things like:
> - delete/undelete Documents -> Can be done by with IndexWriter, too (using 
> deleteByQuery)
> - change norms -> this is a bad idea in general, but when we remove norms at 
> all and replace by DocValues this is obsolete already. Changing DocValues 
> should also be done using IndexWriter in trunk (once it is ready)

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to