dsmiley commented on code in PR #3930:
URL: https://github.com/apache/solr/pull/3930#discussion_r2600900828


##########
solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java:
##########
@@ -1839,24 +1842,55 @@ public void testFieldExistsQueries() throws SyntaxError 
{
                     + query
                     + "\".",
                 createdQuery instanceof ConstantScoreQuery);
-            assertTrue(
-                "PointField with NaN values must include \"exists or NaN\" if 
the field doesn't have norms or docValues: \""
-                    + query
-                    + "\".",
-                ((ConstantScoreQuery) createdQuery).getQuery() instanceof 
BooleanQuery);
-            assertEquals(
-                "PointField with NaN values must include \"exists or NaN\" if 
the field doesn't have norms or docValues: \""
-                    + query
-                    + "\". This boolean query must be an OR.",
-                1,
-                ((BooleanQuery) ((ConstantScoreQuery) createdQuery).getQuery())
-                    .getMinimumNumberShouldMatch());
-            assertEquals(
-                "PointField with NaN values must include \"exists or NaN\" if 
the field doesn't have norms or docValues: \""
-                    + query
-                    + "\". This boolean query must have 2 clauses.",
-                2,
-                ((BooleanQuery) ((ConstantScoreQuery) 
createdQuery).getQuery()).clauses().size());
+            if (schemaField.getType().isPointField()) {

Review Comment:
   I really dislike these tests!  Sorry.  Instead of testing the 
implementation, it should test the functional effect.  Needn't test every combo 
of course but some special values with a bit of randomization.



##########
solr/core/src/java/org/apache/solr/schema/DoublePointField.java:
##########
@@ -178,4 +179,18 @@ public IndexableField createField(SchemaField field, 
Object value) {
   protected StoredField getStoredField(SchemaField sf, Object value) {
     return new StoredField(sf.getName(), (Double) this.toNativeType(value));
   }
+
+  /**
+   * Override the default existence behavior, so that the non-docValued/norms 
implementation matches
+   * NaN values for double and float fields. The [* TO *] query for those 
fields does not match
+   * 'NaN' values, so they must be matched separately.
+   *
+   * <p>For doubles and floats the query behavior is equivalent to 
field:[-Infinity TO NaN] since
+   * NaN has a value greater than +Infinity
+   */
+  @Override
+  public Query getSpecializedExistenceQuery(QParser parser, SchemaField field) 
{
+    return new ConstantScoreQuery(

Review Comment:
   The ConstantScoreQuery wrapper is probably pointless



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to