jpountz commented on code in PR #907:
URL: https://github.com/apache/lucene/pull/907#discussion_r900220890


##########
lucene/core/src/java/org/apache/lucene/index/CheckIndex.java:
##########
@@ -1378,7 +1378,7 @@ private static Status.TermIndexStatus checkFields(
       computedFieldCount++;
 
       final Terms terms = fields.terms(field);
-      if (terms == null) {
+      if (terms == Terms.EMPTY) {

Review Comment:
   Let's remove this `if` block entirely?



##########
lucene/core/src/java/org/apache/lucene/index/CheckIndex.java:
##########
@@ -1378,7 +1378,7 @@ private static Status.TermIndexStatus checkFields(
       computedFieldCount++;
 
       final Terms terms = fields.terms(field);
-      if (terms == null) {
+      if (terms == Terms.EMPTY) {

Review Comment:
   Then let's fix codecs to return a `Terms` instance that has the correct 
values for `hasFreqs`, `hasOffsets`, `hasPositions` and `hasPayloads`? E.g. 
maybe you could add a new `Terms#empty(FieldInfo)` method that does the right 
thing based on the `FieldInfo` and leverage this method in postings formats?



-- 
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: issues-unsubscr...@lucene.apache.org

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