[ https://issues.apache.org/jira/browse/LUCENE-6575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14589441#comment-14589441 ]
Cao Manh Dat edited comment on LUCENE-6575 at 6/17/15 7:52 AM: --------------------------------------------------------------- [~jpountz] Thanks you for you comment. - I agree that chaining in builder make it quite hard to read. I will fix that soon. - About two new constructors of Builder. Currently, PhraseQuery act as BooleanQuery some times (it rely on terms.length() == 0 to rewrite to BooleanQuery). So consumer will not have to care about their terms[] is empty or not, they simply deliver it to PhraseQuery. If we remove these constructors of Builder, consumer will have to check it terms[] size and do the same thing. Is it approciate? was (Author: caomanhdat): [~jpountz] Thanks you for you comment. - I agree that chaining in builder make it quite hard to read. I will fix that soon. - About two new constructors of Builder. Currently, PhraseQuery act as BooleanQuery some times (it rely terms.length() == 0 to rewrite to BooleanQuery). So consumer will not have to care about their terms[] is empty or not, they simply deliver it to PhraseQuery. If we remove these constructors of Builder, consumer will have to check it terms[] size and do the same thing. Is it approciate? > Improve API of PhraseQuery.Builder > ---------------------------------- > > Key: LUCENE-6575 > URL: https://issues.apache.org/jira/browse/LUCENE-6575 > Project: Lucene - Core > Issue Type: Improvement > Reporter: Cao Manh Dat > Priority: Minor > Attachments: LUCENE-6575.patch, LUCENE-6575.patch > > > From LUCENE-6531 > In current PhraseQuery.Builder API. User must retype field again and again : > {code} > PhraseQuery.Builder builder = new PhraseQuery.Builder(); > builder.add(new Term("lyrics", "when"), 1); > builder.add(new Term("lyrics", "believe"), 3); > {code} > Cleaner API : > {code} > PhraseQuery.Builder builder = new PhraseQuery.Builder("lyrics"); > builder.add("when", 1); > builder.add("believe", 3); > {code} -- 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