mayya-sharipova commented on code in PR #16219:
URL: https://github.com/apache/lucene/pull/16219#discussion_r3401535620
##########
lucene/core/src/java/org/apache/lucene/document/column/ColumnValidation.java:
##########
@@ -32,11 +32,76 @@ public final class ColumnValidation {
private ColumnValidation() {}
+ /** Inverted-index aspect ({@code indexOptions() != NONE}). */
+ static final int ASPECT_INVERSION = 1 << 0;
+
+ /** Stored-fields aspect ({@code stored()}). */
+ static final int ASPECT_STORED = 1 << 1;
+
+ /** Doc-values aspect ({@code docValuesType() != NONE}). */
+ static final int ASPECT_DOCVALUES = 1 << 2;
+
+ /** Points aspect ({@code pointDimensionCount() != 0}). */
+ static final int ASPECT_POINTS = 1 << 3;
+
+ /** KNN-vector aspect ({@code vectorDimension() != 0}). */
+ static final int ASPECT_VECTOR = 1 << 4;
+
+ /**
+ * Returns a bitmask of the indexing aspects ({@code ASPECT_*}) declared by
{@code fieldType}.
+ * Used by the column-batch path to enforce that, when several columns share
a field name, each
+ * aspect is carried by at most one column.
+ */
+ public static int aspectMask(IndexableFieldType fieldType) {
+ int mask = 0;
+ if (fieldType.indexOptions() != IndexOptions.NONE) {
+ mask |= ASPECT_INVERSION;
+ }
+ if (fieldType.stored()) {
+ mask |= ASPECT_STORED;
+ }
+ if (fieldType.docValuesType() != DocValuesType.NONE) {
+ mask |= ASPECT_DOCVALUES;
+ }
+ if (fieldType.pointDimensionCount() != 0) {
+ mask |= ASPECT_POINTS;
+ }
+ if (fieldType.vectorDimension() != 0) {
+ mask |= ASPECT_VECTOR;
+ }
+ return mask;
+ }
+
+ /** Returns a human-readable comma-separated list of the aspect names set in
{@code mask}. */
+ public static String aspectNames(int mask) {
+ StringBuilder sb = new StringBuilder();
+ if ((mask & ASPECT_INVERSION) != 0) {
+ sb.append("inversion");
+ }
+ if ((mask & ASPECT_STORED) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("stored");
+ }
+ if ((mask & ASPECT_DOCVALUES) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("doc values");
+ }
+ if ((mask & ASPECT_POINTS) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("points");
+ }
+ if ((mask & ASPECT_VECTOR) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("vectors");
+ }
+ return "[" + sb + "]";
+ }
+
/**
- * Throws {@link IllegalArgumentException} if {@code fieldType} declares no
indexing feature (no
+ * Throws {@link IllegalArgumentException} if {@code fieldType} declares no
indexing aspect (no
* doc values, no points, not stored, no index options, no vectors).
*/
- public static void validateColumnHasIndexingFeature(
+ public static void validateColumnHasIndexingAspect(
Review Comment:
At first I had difficult to understand what is meant by "aspect", I liked
the previous name "feature" better
##########
lucene/core/src/java/org/apache/lucene/document/column/ColumnValidation.java:
##########
@@ -32,11 +32,76 @@ public final class ColumnValidation {
private ColumnValidation() {}
+ /** Inverted-index aspect ({@code indexOptions() != NONE}). */
+ static final int ASPECT_INVERSION = 1 << 0;
+
+ /** Stored-fields aspect ({@code stored()}). */
+ static final int ASPECT_STORED = 1 << 1;
+
+ /** Doc-values aspect ({@code docValuesType() != NONE}). */
+ static final int ASPECT_DOCVALUES = 1 << 2;
+
+ /** Points aspect ({@code pointDimensionCount() != 0}). */
+ static final int ASPECT_POINTS = 1 << 3;
+
+ /** KNN-vector aspect ({@code vectorDimension() != 0}). */
+ static final int ASPECT_VECTOR = 1 << 4;
+
+ /**
+ * Returns a bitmask of the indexing aspects ({@code ASPECT_*}) declared by
{@code fieldType}.
+ * Used by the column-batch path to enforce that, when several columns share
a field name, each
+ * aspect is carried by at most one column.
+ */
+ public static int aspectMask(IndexableFieldType fieldType) {
+ int mask = 0;
+ if (fieldType.indexOptions() != IndexOptions.NONE) {
+ mask |= ASPECT_INVERSION;
+ }
+ if (fieldType.stored()) {
+ mask |= ASPECT_STORED;
+ }
+ if (fieldType.docValuesType() != DocValuesType.NONE) {
+ mask |= ASPECT_DOCVALUES;
+ }
+ if (fieldType.pointDimensionCount() != 0) {
+ mask |= ASPECT_POINTS;
+ }
+ if (fieldType.vectorDimension() != 0) {
+ mask |= ASPECT_VECTOR;
+ }
+ return mask;
+ }
+
+ /** Returns a human-readable comma-separated list of the aspect names set in
{@code mask}. */
+ public static String aspectNames(int mask) {
+ StringBuilder sb = new StringBuilder();
+ if ((mask & ASPECT_INVERSION) != 0) {
+ sb.append("inversion");
+ }
+ if ((mask & ASPECT_STORED) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("stored");
+ }
+ if ((mask & ASPECT_DOCVALUES) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("doc values");
+ }
+ if ((mask & ASPECT_POINTS) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("points");
+ }
+ if ((mask & ASPECT_VECTOR) != 0) {
+ if (!sb.isEmpty()) sb.append(", ");
+ sb.append("vectors");
+ }
+ return "[" + sb + "]";
+ }
+
/**
- * Throws {@link IllegalArgumentException} if {@code fieldType} declares no
indexing feature (no
+ * Throws {@link IllegalArgumentException} if {@code fieldType} declares no
indexing aspect (no
* doc values, no points, not stored, no index options, no vectors).
*/
- public static void validateColumnHasIndexingFeature(
+ public static void validateColumnHasIndexingAspect(
Review Comment:
At first I had difficulty to understand what is meant by "aspect", I liked
the previous name "feature" 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.
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]