[ https://issues.apache.org/jira/browse/LUCENE-6531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14587906#comment-14587906 ]
Cao Manh Dat commented on LUCENE-6531: -------------------------------------- [~jpountz] : It look like we can modify PhraseQuery api a little bit. For a long time we set PhraseQuery.field base on the field of first term added to PhraseQuery, and it throw exception when terms added to PhraseQuery not have same field. We even allow null for field and in rewrite method we return and empty BooleanQuery with boost (what!!). Since we have a builder today, why not modify it little bit to make PhraseQuery clearer? - Change PhraseQuery.Builder() -> PhraseQuery.Builder(String field) - Change PhraseQuery.Builder.add(Term term) -> PhraseQuery.Builder.add(String termText) - We then deprecated all public constructor of PhraseQuery After that PhraseQuery we be much clearer! I will happy to submit a patch. > 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: Trunk > > Attachments: LUCENE-6531.patch, 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