You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "dsmiley (via GitHub)" <gi...@apache.org> on 2023/03/25 16:32:52 UTC

[GitHub] [solr] dsmiley commented on a diff in pull request #1488: SOLR-12963: add support for node-level uninvertible support configuration

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


##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -197,9 +197,17 @@ private static DirectoryReader getReader(
   private static DirectoryReader wrapReader(SolrCore core, DirectoryReader reader)
       throws IOException {
     assert reader != null;
-    return ExitableDirectoryReader.wrap(
-        UninvertingReader.wrap(reader, core.getLatestSchema().getUninversionMapper()),
-        SolrQueryTimeoutImpl.getInstance());
+    switch (IndexSchema.getUninvertibleSupport()) {

Review Comment:
   feels like it should be an instance method on the IndexSchema, not a global lookup.  Even if it may be toggle-able at a global level.



##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -197,9 +197,17 @@ private static DirectoryReader getReader(
   private static DirectoryReader wrapReader(SolrCore core, DirectoryReader reader)
       throws IOException {
     assert reader != null;
-    return ExitableDirectoryReader.wrap(
-        UninvertingReader.wrap(reader, core.getLatestSchema().getUninversionMapper()),
-        SolrQueryTimeoutImpl.getInstance());
+    switch (IndexSchema.getUninvertibleSupport()) {
+      case DEFAULT_FALSE:
+      case DEFAULT_TRUE:
+        reader = UninvertingReader.wrap(reader, core.getLatestSchema().getUninversionMapper());

Review Comment:
   If the schema has no field types declared UNINVERTABLE (wether it occurs explicitly or via a default), we could skip this wrap here.  Not strictly necessary but it removes a thin layer of indirection.  Such logic could go here or be in the wrap method if, say, we have the uninversionMapper return null.



##########
solr/core/src/java/org/apache/solr/schema/IndexSchema.java:
##########
@@ -116,6 +116,18 @@ public class IndexSchema {
   private static final String SOURCE_DYNAMIC_BASE = "sourceDynamicBase";
   private static final String SOURCE_EXPLICIT_FIELDS = "sourceExplicitFields";
 
+  /**
+   * Implicit default for `uninvertible` FieldType property, if not specified by `fieldType` or
+   * `field`. This implicit default may be overridden by a node-level default specified in
+   * `solr.xml`. The implicit defaults is <code>true</code> for historical reasons, but users are
+   * strongly encouraged to set this to <code>false</code> for stability and use <code>
+   * docValues="true"</code> or <code>uninvertible="true"</code> as needed.
+   */
+  public static final UninvertingReader.Support IMPLICIT_DEFAULT_UNINVERTIBLE =
+      UninvertingReader.Support.DEFAULT_TRUE;

Review Comment:
   Presumably we could quickly follow-up with a master-only change (v10) to DEFAULT_FALSE.



##########
solr/core/src/java/org/apache/solr/schema/IndexSchema.java:
##########
@@ -116,6 +116,18 @@ public class IndexSchema {
   private static final String SOURCE_DYNAMIC_BASE = "sourceDynamicBase";
   private static final String SOURCE_EXPLICIT_FIELDS = "sourceExplicitFields";
 
+  /**
+   * Implicit default for `uninvertible` FieldType property, if not specified by `fieldType` or
+   * `field`. This implicit default may be overridden by a node-level default specified in
+   * `solr.xml`. The implicit defaults is <code>true</code> for historical reasons, but users are
+   * strongly encouraged to set this to <code>false</code> for stability and use <code>
+   * docValues="true"</code> or <code>uninvertible="true"</code> as needed.
+   */
+  public static final UninvertingReader.Support IMPLICIT_DEFAULT_UNINVERTIBLE =
+      UninvertingReader.Support.DEFAULT_TRUE;
+
+  private static UninvertingReader.Support uninvertibleSupport = IMPLICIT_DEFAULT_UNINVERTIBLE;

Review Comment:
   static non-final variables concern me, as they should anyone.  It has to be handled carefully in tests to ensure it's reset.  If we can avoid this, we should.  Did you investigate passing this into the IndexSchema constructor, ultimately held in the NodeConfig?



-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org