You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/06/21 16:13:29 UTC

lucene-solr:master: SOLR-10929: Removed unused 'valType' option from ExternalFileField

Repository: lucene-solr
Updated Branches:
  refs/heads/master 8e9d685a4 -> 1737fce5d


SOLR-10929: Removed unused 'valType' option from ExternalFileField


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1737fce5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1737fce5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1737fce5

Branch: refs/heads/master
Commit: 1737fce5df106847fb5d93eb46ba7b062072c589
Parents: 8e9d685
Author: Chris Hostetter <ho...@apache.org>
Authored: Wed Jun 21 09:13:22 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Wed Jun 21 09:13:22 2017 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  6 +++++
 .../apache/solr/schema/ExternalFileField.java   | 14 -----------
 .../conf/bad-schema-external-filefield.xml      | 25 --------------------
 .../solr/collection1/conf/schema-trie.xml       |  4 +---
 .../solr/collection1/conf/schema11.xml          | 16 +++----------
 .../apache/solr/schema/BadIndexSchemaTest.java  |  5 ----
 6 files changed, 10 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d754590..64bd4b5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -108,6 +108,9 @@ Upgrading from Solr 6.x
 * The default for eDismax parameter 'lowercaseOperators' now depends on the luceneMatchVersion setting in solrconfig.
   It remains 'true' for luceneMatchVersion < 7.0.0 and changes to 'false' from 7.0.0. See also SOLR-4646
 
+* The unused 'valType' option has been removed from ExternalFileField, if you have this in your schema you
+  can safely remove it. see SOLR-10929 for more details.
+
 New Features
 ----------------------
 * SOLR-9857, SOLR-9858: Collect aggregated metrics from nodes and shard leaders in overseer. (ab)
@@ -300,6 +303,9 @@ Other Changes
 
 * SOLR-8256: Set legacyCloud=false as default (Cao Manh Dat)
 
+* SOLR-10929: Removed unused 'valType' option from ExternalFileField (hossman)
+
+
 ==================  6.7.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java b/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java
index feba4e0..da4b4db 100644
--- a/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java
+++ b/solr/core/src/java/org/apache/solr/schema/ExternalFileField.java
@@ -22,7 +22,6 @@ import java.util.Map;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.SortField;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.response.TextResponseWriter;
 import org.apache.solr.search.QParser;
 import org.apache.solr.search.function.FileFloatSource;
@@ -35,9 +34,6 @@ import org.apache.solr.uninverting.UninvertingReader.Type;
  * <li>It's OK to have some documents without a keyField in the file (defVal is used as the default)</li>
  * <li>It's OK for a keyField value to point to multiple documents (no uniqueness requirement)</li>
  * </ul>
- * <code>valType</code> is a reference to another fieldType to define the value type of this field
- * (must currently be TrieFloatField or LegacyFloatField (valType="pfloat|float|tfloat") if used).
- * This parameter has never been implemented. As of Solr 3.6/4.0 it is optional and can be omitted.
  *
  * The format of the external file is simply newline separated keyFieldValue=floatValue.
  * <br>Example:
@@ -65,16 +61,6 @@ public class ExternalFileField extends FieldType implements SchemaAware {
   @Override
   protected void init(IndexSchema schema, Map<String, String> args) {
     restrictProps(SORT_MISSING_FIRST | SORT_MISSING_LAST);
-    // valType has never been used for anything except to throw an error, so make it optional since the
-    // code (see getValueSource) gives you a FileFloatSource.
-    String ftypeS = args.remove("valType");
-    if (ftypeS != null) {
-      ftype = schema.getFieldTypes().get(ftypeS);
-      if (ftype != null && !(ftype instanceof TrieFloatField)) {
-        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
-            "Only float (TrieFloatField) is currently supported as external field type.  Got " + ftypeS);
-      }
-    }
     keyFieldName = args.remove("keyField");
     String defValS = args.remove("defVal");
     defVal = defValS == null ? 0 : Float.parseFloat(defValS);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/core/src/test-files/solr/collection1/conf/bad-schema-external-filefield.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-external-filefield.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-external-filefield.xml
deleted file mode 100644
index 75d6a30..0000000
--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-external-filefield.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-
-<schema name="bad-schema-external-filefield" version="1.0">
-  <fieldType name="tint" class="solr.TrieIntField" omitNorms="true" positionIncrementGap="0"/>
-
-  <fieldType name="eff_none" keyField="id" defVal="0"
-             stored="false" indexed="true"
-             class="solr.ExternalFileField" valType="tint"/>
-
-</schema>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/core/src/test-files/solr/collection1/conf/schema-trie.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-trie.xml b/solr/core/src/test-files/solr/collection1/conf/schema-trie.xml
index 775ec9d..525ea51 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-trie.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-trie.xml
@@ -253,9 +253,7 @@
    -->
   <fieldType name="ignored" stored="false" indexed="false" class="solr.StrField"/>
 
-  <fieldType name="file" keyField="id" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField"
-             valType="float"/>
-
+  <fieldType name="file" keyField="id" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" />
 
   <!-- Valid attributes for fields:
     name: mandatory - the name for the field

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/core/src/test-files/solr/collection1/conf/schema11.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema11.xml b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
index 5c124c7..487a65c 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema11.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
@@ -245,9 +245,9 @@
      --> 
     <fieldType name="ignored" stored="false" indexed="false" class="solr.StrField" /> 
 
-    <fieldType name="file" keyField="id" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" valType="float"/>
+    <fieldType name="file" keyField="id" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" />
 
-    <fieldType name="sfile" keyField="sfile_s" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" valType="float"/>
+    <fieldType name="sfile" keyField="sfile_s" defVal="1" stored="false" indexed="false" class="solr.ExternalFileField" />
 
 
     <fieldType name="tint" class="solr.TrieIntField"  omitNorms="true" positionIncrementGap="0"/>
@@ -275,19 +275,9 @@
 valued. -->
     <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
 
-     <!-- These should pass right through and insure that we can declare external field types -->
-    <fieldType name="eff_float" keyField="id" defVal="0"
-               stored="false" indexed="true"
-               class="solr.ExternalFileField" valType="float"/>
-
     <fieldType name="eff_tfloat" keyField="eff_ti" defVal="0"
                stored="false" indexed="true"
-               class="solr.ExternalFileField" valType="tfloat"/>
-
-    <!-- Be sure that the valType can be optional Since valType has done nothing up until now, this is preferred -->
-    <fieldType name="eff_none" keyField="id" defVal="0"
-               stored="false" indexed="true"
-               class="solr.ExternalFileField"/>
+               class="solr.ExternalFileField" />
 
     <fieldType name="text_no_analyzer" stored="false" indexed="true" class="solr.TextField" />
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1737fce5/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
index f635436..b7d00a9 100644
--- a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java
@@ -53,11 +53,6 @@ public class BadIndexSchemaTest extends AbstractBadConfigTestBase {
     doTest("bad-schema-analyzer-class-and-nested.xml", "bad_type");
   }
 
-  public void testBadExternalFileField() throws Exception {
-    doTest("bad-schema-external-filefield.xml",
-           "Only float (TrieFloatField) is currently supported as external field type.");
-  }
-
   public void testUniqueKeyRules() throws Exception {
     doTest("bad-schema-uniquekey-is-copyfield-dest.xml", 
            "can not be the dest of a copyField");