jtibshirani commented on a change in pull request #185:
URL: https://github.com/apache/lucene/pull/185#discussion_r658097724



##########
File path: 
lucene/sandbox/src/java/org/apache/lucene/sandbox/search/MultiNormsLeafSimScorer.java
##########
@@ -62,6 +67,14 @@
           weightList.add(field.weight);
         }
       }
+
+      if (normsList.isEmpty() == false && normsList.size() != 
normFields.size()) {
+        throw new IllegalArgumentException(
+            getClass().getSimpleName()
+                + " requires norms to be consistent across fields: some fields 
cannot"
+                + " have norms enabled, while others have norms disabled");

Review comment:
       Properly throwing an error would require a more invasive change, since 
we rewrite the query very early if scores aren't needed: 
https://github.com/apache/lucene/blob/9942d59f0dc92db28d1dd79bf321cd2a05cdb6d1/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/CombinedFieldQuery.java#L262-L265
 However I could refactor this part in `MultiNormsLeafSimScorer` just to be 
clearer/ more solid?
   
   This also made me notice -- I'm using the fact that 
`LeafReader#getNormsValues` is `null` to detect that norms were disabled. This 
seems accurate but I couldn't confirm it's really part of the method contract. 
I wonder if checking field infos is better.




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to