mayya-sharipova commented on a change in pull request #11:
URL: https://github.com/apache/lucene/pull/11#discussion_r596378102



##########
File path: lucene/core/src/java/org/apache/lucene/index/FieldInfo.java
##########
@@ -111,6 +111,43 @@ public FieldInfo(
 
   /** Performs internal consistency checks. Always returns true (or throws 
IllegalStateException) */
   public boolean checkConsistency() {
+    return checkOptionsCorrectness(
+        name,
+        storeTermVector,
+        omitNorms,
+        storePayloads,
+        indexOptions,
+        docValuesType,
+        dvGen,
+        pointDimensionCount,
+        pointIndexDimensionCount,
+        pointNumBytes,
+        vectorDimension,
+        vectorSearchStrategy);
+  }
+
+  /**
+   * Check correctness of FieldInfo options
+   *
+   * @throws IllegalStateException if some options are incorrect
+   * @return {@code true} if all options are correct
+   */
+  public static boolean checkOptionsCorrectness(
+      String name,
+      boolean storeTermVector,
+      boolean omitNorms,
+      boolean storePayloads,
+      IndexOptions indexOptions,
+      DocValuesType docValuesType,
+      long dvGen,
+      int pointDimensionCount,
+      int pointIndexDimensionCount,
+      int pointNumBytes,
+      int vectorDimension,
+      VectorValues.SearchStrategy vectorSearchStrategy) {
+    if (indexOptions == null) {
+      throw new IllegalStateException("IndexOptions must not be null (field: 
'" + name + "')");

Review comment:
       @s1monw  Do you mean a separate static method for each different error 
message? 
   In a follow-up PR I plan to remove set methods from FieldInfo 
(`setDocValuesType`,  `setIndexOptions`) where some of these error messages are 
repeated.




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