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

This commit is contained in:
Chris Hostetter 2017-06-21 09:13:22 -07:00
parent 8e9d685a40
commit 1737fce5df
6 changed files with 10 additions and 60 deletions

View File

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

View File

@ -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);

View File

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

View File

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

View File

@ -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" />

View File

@ -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");