You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Cao Manh Dat (JIRA)" <ji...@apache.org> on 2015/06/17 09:53:00 UTC

[jira] [Comment Edited] (LUCENE-6575) Improve API of PhraseQuery.Builder

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