lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: [jira] Commented: (LUCENE-2757) Refactor RewriteMethods out of MultiTermQuery
Date Sun, 14 Nov 2010 22:49:32 GMT
I am also in the opinion, that queries should be immutable! But this is not really related
to this issue.

> After this, in-place rewriting goes away. If you want a rewritten query, you instantiate
a new tree via adding a few new query objects. Immutable queries and query trees do not have
to be reinstantiated; you simply use them as-is.

We never rewrite in-place! See below:

> Also, and this is more important: immutable objects are immune to concurrenty problems.
Rewriting mutable query trees is a fine way to create very-hard-to-find concurrency problems.
Going immutable makes this problem disappear.

I don't think this is currently a problem. Rewriting a query never (should) touch the query
itsself. It always returns itsself or a *new* query. So there are no concurrency problems.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Lance Norskog [mailto:goksron@gmail.com]
> Sent: Sunday, November 14, 2010 11:41 PM
> To: dev@lucene.apache.org
> Subject: Re: [jira] Commented: (LUCENE-2757) Refactor RewriteMethods out of
> MultiTermQuery
> 
> Is it feasible to make Query immutable? That is, all Query objects be
> immutable?
> Most of them only have a setBoost(), which can be shoveled into the
> constructor.
> 
> After this, in-place rewriting goes away. If you want a rewritten query, you
> instantiate a new tree via adding a few new query objects. Immutable queries
> and query trees do not have to be reinstantiated; you simply use them as-is.
> 
> Also, and this is more important: immutable objects are immune to
> concurrenty problems. Rewriting mutable query trees is a fine way to create
> very-hard-to-find concurrency problems. Going immutable makes this problem
> disappear.
> 
> After all, 4.0 still appears to be in 'throw all the chopsticks in the air' mode.
> 
> Lance Norskog
> 
> Uwe Schindler (JIRA) wrote:
> >      [
> > https://issues.apache.org/jira/browse/LUCENE-2757?page=com.atlassian.j
> > ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=129
> > 31911#action_12931911 ]
> >
> > Uwe Schindler commented on LUCENE-2757:
> > ---------------------------------------
> >
> > I will commit this soon and then do backporting!
> >
> >
> >> Refactor RewriteMethods out of MultiTermQuery
> >> ---------------------------------------------
> >>
> >>                  Key: LUCENE-2757
> >>                  URL: https://issues.apache.org/jira/browse/LUCENE-2757
> >>              Project: Lucene - Java
> >>           Issue Type: Improvement
> >>     Affects Versions: 3.1, 4.0
> >>             Reporter: Uwe Schindler
> >>             Assignee: Uwe Schindler
> >>             Priority: Minor
> >>              Fix For: 3.1, 4.0
> >>
> >>          Attachments: LUCENE-2757-refactor1.patch,
> >> LUCENE-2757-refactor1.patch, LUCENE-2757.patch
> >>
> >>
> >> Policeman work :-) - as usual
> >>
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org



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


Mime
View raw message