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

Yonik Seeley commented on LUCENE-6369:
--------------------------------------

Hmmm, but clone() did exactly what I wanted previously... a shallow clone.   
It's also more in line with Java cloning of things like List, Map, etc.  Was 
anyone hitting an issue due to shallow cloning? 

Also, what happens to deeply nested boolean queries during a rewrite?  It looks 
like we might now make a copy of everything just because one thing changed?  
That could also represent a significant regression for some.  We might also 
have an N^2 bug (N==nesting depth) where each level does a deep clone()?  It's 
definitely harder to understand/debug the BooleanQuery.rewrite w/ deep cloning


> Make queries more defensive and clone deeply
> --------------------------------------------
>
>                 Key: LUCENE-6369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6369
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>             Fix For: 5.1
>
>         Attachments: LUCENE-6369.patch
>
>
> It is very important for the query cache that queries be either immutable or 
> clone deeply so that they cannot change after having been put into the cache.
> There are three issues that need to be addressed:
>  - mutable queries such as boolean or phrase queries do not clone deeply
>  - queries that wrap mutable objects such as TermQuery's term
>  - filters inherit Query's default clone impl which is not enough in most 
> cases



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to