You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2015/06/08 18:02:00 UTC

[jira] [Commented] (LUCENE-6531) Make PhraseQuery immutable

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

Robert Muir commented on LUCENE-6531:
-------------------------------------

I think TermAndPosition is very awkward. Can we somehow avoid a new class here?

The only advantage it has, is that you cant screw up by using a different field, but we shouldn't fashion APIs around error/abuse cases, and the disadvantages here (new class, and now position is mandatory but its confusing what it should be, should it start at 0 or 1, etc etc).

This stuff adds up to make it way harder than today, where its a POJO with simple add() method and position is optional.

{code}
PhraseQuery q = new PhraseQuery();
q.add(new Term(...));
q.add(new Term(...));
{code}

> Make PhraseQuery immutable
> --------------------------
>
>                 Key: LUCENE-6531
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6531
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>             Fix For: 6.0
>
>         Attachments: LUCENE-6531.patch
>
>
> 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
(v6.3.4#6332)

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