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

Adrien Grand commented on LUCENE-6531:
--------------------------------------

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

If we don't want to have a wrapper around a term and a position, then the only 
options I see would be to either require users to provide two arrays/lists, one 
for terms and one for positions, or to use a builder in order to hide this 
wrapper: the builder could have a {{add(BytesRef term, int position)}} method 
like PhraseQuery does today. I don't really like APIs that expect users to 
provide parallel arrays, and even though I don't mind builders in general I 
think some other committers strongly dislike them so I thought the 
Term/position wrapper was a good option. It's also similar to how BooleanClause 
wraps a Query and an Occur?

bq. should it start at 0 or 1

Both would work since positions are relative.

> 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-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to