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

Robert Muir commented on LUCENE-3273:
-------------------------------------

the difference here, is that I think in general the tests should use/look like 
the API.

this makes them readable for people (e.g. new contributors) who already know 
lucene's API to
understand what the tests do.

For example in the lucene tests we added various randomization, but we tried to 
make it look just like the API, except deleting a space:

{noformat}
new IndexWriterConfig() -> newIndexWriterConfig()
new Directory() -> newDirectory()
new Field() -> newField()
...
{noformat}

in some of these tests, I think its actually *way more clear* to explicitly 
build the BQs and not use any builders or parsers, especially TestBoolean2 for 
example.

I fear sometimes, people get caught up on "more lines of code" == bad. I think 
this is wrong, sometimes more lines of code is good.

parsers, builder apis, and helper methods might reduce the number of lines of 
code, but they add additional layers and obfuscation that makes this a terrible 
tradeoff.


> Convert Lucene Core tests over to a simple MockQueryParser
> ----------------------------------------------------------
>
>                 Key: LUCENE-3273
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3273
>             Project: Lucene - Java
>          Issue Type: Sub-task
>          Components: core/other
>            Reporter: Chris Male
>         Attachments: LUCENE-3273.patch
>
>
> Most tests use Lucene Core's QueryParser for convenience.  We want to 
> consolidate it into a QP module which we can't have as a dependency.  We 
> should add a simple MockQueryParser which does String.split() on the query 
> string, analyzers the terms and builds a BooleanQuery if necessary.  Any more 
> complex Queries (such as phrases) should be done programmatically. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to