lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Vanlerberghe (JIRA)" <>
Subject [jira] [Commented] (LUCENE-7064) Make MultiPhraseQuery immutable
Date Thu, 03 Mar 2016 15:25:18 GMT


Luc Vanlerberghe commented on LUCENE-7064:

I updated the PR so modifying a Builder no longer affects already created queries
I aligned the signatures of getTermArrays and getPositions with the ones in PhraseQuery.

>From Adrien Grand:
Actually I think returning a list is better: with arrays you need to perform a deep copy if
you want to make sure that the user cannot change the internal state of the query. We could
keep arrays internally and call Collections.unmodifiableList(Arrays.asList(termArrays)) when
returning the terms to the user?

For the getTermArrays case that would involve creating wrappers of wrappers since it returns
a two-dimensional array.

For now I just added a "Do not modify!" in the doc comment...

> Make MultiPhraseQuery immutable
> -------------------------------
>                 Key: LUCENE-7064
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/search
>            Reporter: Luc Vanlerberghe
>            Priority: Minor
>             Fix For: master, 6.0
> See LUCENE-6531
> Mutable queries are an issue for automatic filter caching since modifying a query after
it has been put into the cache will corrupt the cache. We should make all queries immutable
(up to the boost) to avoid this issue.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message