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

Robert Muir commented on LUCENE-6575:
-------------------------------------

Uwe said it right. Look at his patch: 
https://issues.apache.org/jira/secure/attachment/12692229/LUCENE-6177.patch

Uwe's tests are like this, each thing on its own line, and readable:

{code}
StringBuilder sb = new StringBuilder()
    .append(xxx)
    .append(yyy);
{code}

this is also fine:

{code}
StringBuilder sb = new StringBuilder();
sb.append(xxx);
sb.append(yyy);
{code}

on the other hand this is terrible:
{code}
StringBuilder sb = new StringBuilder().append(xxx).append(yyy)...
{code}

As far as concerns about method names, same situation there:
Please keep verbs like {{get}} and {{set}}, it may seem old fashioned but it 
makes code readable. It gives important hints about what the method is doing. 
You know instantly from the name a little bit more about what is happening 
without having to read source code.


> 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

Reply via email to