[ 
https://issues.apache.org/jira/browse/SOLR-1131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788113#action_12788113
 ] 

Yonik Seeley commented on SOLR-1131:
------------------------------------

Some minor nits about tests in general that I've also noticed in the past:
IMO, unit tests can be too low level.  They can also be too fragile.

The test below is a pain to maintain... it essentially means you can't change 
the schema at all w/o breaking the test.
+    Map<String,FieldType> polyFs = schema.getPolyFieldTypes();
+    assertNotNull(polyFs);
+    assertTrue(polyFs.size() == 3);

I also prefer testing low level *behavior* as opposed to testing low level 
implementation.
It would be nice, for example, if testPointFieldType indexed a few couments 
(with various combinations of stored / indexed)  and then queried the index, 
with our high level xpath validation code to test that the field was correctly 
matched and had stored, or had not stored the value.

Rendundant null checks, trivial strings, etc:
+    assertNotNull("topDocs is null", topDocs);
+    assertTrue(topDocs.totalHits + " does not equal: " + 1, topDocs.totalHits 
== 1)

Things like the above can be replaced with the much more concise and readable:
assertEquals(1, topDocs.totalHits)

But really, stuff like this:
+ TopDocs topDocs = core.getSearcher().get().search(bq, 1);

Should normally use the higher level search and xpath validate  functionallity. 
 The code above actually leads to a refcount leak.

schema.xml: geo will be core... let's not add a new/different schema file in 
tests for this and simply add it to the latest schema12


> Allow a single field type to index multiple fields
> --------------------------------------------------
>
>                 Key: SOLR-1131
>                 URL: https://issues.apache.org/jira/browse/SOLR-1131
>             Project: Solr
>          Issue Type: New Feature
>          Components: Schema and Analysis
>            Reporter: Ryan McKinley
>            Assignee: Grant Ingersoll
>             Fix For: 1.5
>
>         Attachments: SOLR-1131-IndexMultipleFields.patch, SOLR-1131.patch, 
> SOLR-1131.patch, SOLR-1131.patch, SOLR-1131.patch, SOLR-1131.patch
>
>
> In a few special cases, it makes sense for a single "field" (the concept) to 
> be indexed as a set of Fields (lucene Field).  Consider SOLR-773.  The 
> concept "point" may be best indexed in a variety of ways:
>  * geohash (sincle lucene field)
>  * lat field, lon field (two double fields)
>  * cartesian tiers (a series of fields with tokens to say if it exists within 
> that region)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to