Apache Solr open-source search software
SOLR-17683: Remove CurrencyField (#3212)
Eric Pugh1f7e2cc76054
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex c9973dfbbe2..c62fc85244d 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -115,6 +115,8 @@ Deprecation Removals* SOLR-17655: Removed deprecated ExternalFileField field type. (Eric Pugh)+* SOLR-17683: Removed deprecated CurrencyField field type. (Eric Pugh)+Dependency Upgrades---------------------(No changes)diff --git a/solr/core/src/java/org/apache/solr/handler/component/RangeFacetRequest.java b/solr/core/src/java/org/apache/solr/handler/component/RangeFacetRequest.javaindex 03b60965d92..eecb97f0086 100644--- a/solr/core/src/java/org/apache/solr/handler/component/RangeFacetRequest.java+++ b/solr/core/src/java/org/apache/solr/handler/component/RangeFacetRequest.java@@ -805,7 +805,7 @@ public class RangeFacetRequest extends FacetComponent.FacetBase {if (!(this.field.getType() instanceof CurrencyFieldType)) {throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,- "Cannot perform range faceting over non CurrencyField fields");+ "Cannot perform range faceting over non CurrencyFieldType fields");}defaultCurrencyCode = ((CurrencyFieldType) this.field.getType()).getDefaultCurrency();exchangeRateProvider = ((CurrencyFieldType) this.field.getType()).getProvider();diff --git a/solr/core/src/java/org/apache/solr/schema/CurrencyField.java b/solr/core/src/java/org/apache/solr/schema/CurrencyField.javadeleted file mode 100644index cee593b5708..00000000000--- a/solr/core/src/java/org/apache/solr/schema/CurrencyField.java+++ /dev/null@@ -1,121 +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.- */--package org.apache.solr.schema;--import java.util.ArrayList;-import java.util.Collections;-import java.util.HashMap;-import java.util.List;-import java.util.Map;-import org.apache.lucene.util.ResourceLoaderAware;-import org.apache.solr.common.SolrException;-import org.apache.solr.common.SolrException.ErrorCode;-import org.apache.solr.common.util.CollectionUtil;--/**- * Field type for support of monetary values.- *- * <p>See <a- * href="https://solr.apache.org/guide/solr/latest/indexing-guide/currencies-exchange-rates.html">https://solr.apache.org/guide/solr/latest/indexing-guide/currencies-exchange-rates.html</a>- *- * @deprecated Use {@link CurrencyFieldType}- */-@Deprecated-public class CurrencyField extends CurrencyFieldType implements SchemaAware, ResourceLoaderAware {- protected static final String FIELD_SUFFIX_AMOUNT_RAW = "_amount_raw";- protected static final String FIELD_SUFFIX_CURRENCY = "_currency";- protected static final String FIELD_TYPE_AMOUNT_RAW = "amount_raw_type_long";- protected static final String FIELD_TYPE_CURRENCY = "currency_type_string";- protected static final String PARAM_PRECISION_STEP = "precisionStep";- protected static final String DEFAULT_PRECISION_STEP = "0";-- @Override- protected void init(IndexSchema schema, Map<String, String> args) {-- // Fail if amountLongSuffix or codeStrSuffix are specified- List<String> unknownParams = new ArrayList<>();- fieldSuffixAmountRaw = args.get(PARAM_FIELD_SUFFIX_AMOUNT_RAW);- if (fieldSuffixAmountRaw != null) {- unknownParams.add(PARAM_FIELD_SUFFIX_AMOUNT_RAW);- }- fieldSuffixCurrency = args.get(PARAM_FIELD_SUFFIX_CURRENCY);- if (fieldSuffixCurrency != null) {- unknownParams.add(PARAM_FIELD_SUFFIX_CURRENCY);- }- if (!unknownParams.isEmpty()) {- throw new SolrException(ErrorCode.SERVER_ERROR, "Unknown parameter(s): " + unknownParams);- }-- String precisionStepString = args.get(PARAM_PRECISION_STEP);- if (precisionStepString == null) {- precisionStepString = DEFAULT_PRECISION_STEP;- } else {- args.remove(PARAM_PRECISION_STEP);- }-- // NOTE: because we're not using the PluginLoader to register these field types, they aren't- // "real" field types and never get Schema default properties (based on schema.xml's version- // attribute) so only the properties explicitly set here (or on the SchemaField's we create from- // them) are used.- //- // In theory we should fix this, but since this class is already deprecated, we'll leave it- // alone to simplify the risk of back-compat break for existing users.-- // Initialize field type for amount- fieldTypeAmountRaw = new TrieLongField();- fieldTypeAmountRaw.setTypeName(FIELD_TYPE_AMOUNT_RAW);- Map<String, String> map = CollectionUtil.newHashMap(1);- map.put("precisionStep", precisionStepString);- fieldTypeAmountRaw.init(schema, map);- fieldSuffixAmountRaw = FIELD_SUFFIX_AMOUNT_RAW;-- // Initialize field type for currency string- fieldTypeCurrency = new StrField();- fieldTypeCurrency.setTypeName(FIELD_TYPE_CURRENCY);- fieldTypeCurrency.init(schema, Collections.emptyMap());- fieldSuffixCurrency = FIELD_SUFFIX_CURRENCY;-- super.init(schema, args); // Must be called last so that field types are not doubly created- }-- private void createDynamicCurrencyField(String suffix, FieldType type) {- String name = "*" + POLY_FIELD_SEPARATOR + suffix;- Map<String, String> props = new HashMap<>();- props.put("indexed", "true");- props.put("stored", "false");- props.put("multiValued", "false");- props.put("omitNorms", "true");- props.put("uninvertible", "true");- int p = SchemaField.calcProps(name, type, props);- schema.registerDynamicFields(SchemaField.create(name, type, p, null));- }-- /**- * When index schema is informed, add dynamic fields "*____currency" and "*____amount_raw".- *- * <p>{@inheritDoc}- *- * @param schema {@inheritDoc}- */- @Override- public void inform(IndexSchema schema) {- createDynamicCurrencyField(FIELD_SUFFIX_CURRENCY, fieldTypeCurrency);- createDynamicCurrencyField(FIELD_SUFFIX_AMOUNT_RAW, fieldTypeAmountRaw);- super.inform(schema);- }-}diff --git a/solr/core/src/java/org/apache/solr/schema/CurrencyValue.java b/solr/core/src/java/org/apache/solr/schema/CurrencyValue.javaindex 8d2edb735b7..7aba8e7dc89 100644--- a/solr/core/src/java/org/apache/solr/schema/CurrencyValue.java+++ b/solr/core/src/java/org/apache/solr/schema/CurrencyValue.java@@ -65,7 +65,7 @@ public class CurrencyValue implements Comparable<CurrencyValue> {return null;}- Currency currency = CurrencyField.getCurrency(code);+ Currency currency = CurrencyFieldType.getCurrency(code);if (currency == null) {throw new SolrException(diff --git a/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java b/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.javaindex 5c6ab871799..e2c4e64d583 100644--- a/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java+++ b/solr/core/src/java/org/apache/solr/schema/ExchangeRateProvider.java@@ -21,7 +21,7 @@ import java.util.Set;import org.apache.lucene.util.ResourceLoader;import org.apache.solr.common.SolrException;-/** Interface for providing pluggable exchange rate providers to @CurrencyField */+/** Interface for providing pluggable exchange rate providers to {@link CurrencyFieldType} */public interface ExchangeRateProvider {/*** Get the exchange rate between the two given currenciesdiff --git a/solr/core/src/java/org/apache/solr/schema/OpenExchangeRatesOrgProvider.java b/solr/core/src/java/org/apache/solr/schema/OpenExchangeRatesOrgProvider.javaindex a17dd6fc78b..887287e1a1a 100644--- a/solr/core/src/java/org/apache/solr/schema/OpenExchangeRatesOrgProvider.java+++ b/solr/core/src/java/org/apache/solr/schema/OpenExchangeRatesOrgProvider.java@@ -35,8 +35,8 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;/**- * Exchange Rates Provider for {@link CurrencyField} and {@link CurrencyFieldType} capable of- * fetching & parsing the freely available exchange rates from openexchangerates.org+ * Exchange Rates Provider for {@link CurrencyFieldType} capable of fetching & parsing the+ * freely available exchange rates from openexchangerates.org** <p>Configuration Options:*diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetRangeProcessor.java b/solr/core/src/java/org/apache/solr/search/facet/FacetRangeProcessor.javaindex 554f6f762b3..0192027055b 100644--- a/solr/core/src/java/org/apache/solr/search/facet/FacetRangeProcessor.java+++ b/solr/core/src/java/org/apache/solr/search/facet/FacetRangeProcessor.java@@ -920,7 +920,7 @@ class FacetRangeProcessor extends FacetProcessor<FacetRange> {if (!(this.field.getType() instanceof CurrencyFieldType)) {throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,- "Cannot perform range faceting over non CurrencyField fields");+ "Cannot perform range faceting over non CurrencyFieldType fields");}defaultCurrencyCode = ((CurrencyFieldType) this.field.getType()).getDefaultCurrency();exchangeRateProvider = ((CurrencyFieldType) this.field.getType()).getProvider();diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-dynamic-multivalued.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-dynamic-multivalued.xmldeleted file mode 100644index 7291b7be759..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-dynamic-multivalued.xml+++ /dev/null@@ -1,30 +0,0 @@-<?xml version="1.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-currency-ft-multivalued" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <!-- BEGIN BAD STUFF: multiValued -->- <dynamicField name="*_c" type="currency" indexed="true" stored="true" multiValued="true"/>- <!-- END BAD STUFF -->-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-amount-suffix.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-amount-suffix.xmldeleted file mode 100644index c06403e889b..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-amount-suffix.xml+++ /dev/null@@ -1,34 +0,0 @@-<?xml version="1.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-currency-ft-amount-suffix" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <fieldType name="plong" class="solr.LongPointField" multiValued="false"/>-- <!-- BEGIN BAD STUFF: amountLongSuffix not allowed -->- <fieldType name="currency" class="solr.CurrencyField" amountLongSuffix="_l" multiValued="false"/>- <!-- END BAD STUFF -->-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <dyanmicField name="*_l" type="plong" multiValued="false"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-code-in-xml.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-code-in-xml.xmldeleted file mode 100644index 02b25f8c04c..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-code-in-xml.xml+++ /dev/null@@ -1,33 +0,0 @@-<?xml version="1.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-currency-ft-bogus-code-in-xml" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <!-- BEGIN BAD STUFF: bad-currency.xml has bogus code-->- <fieldType name="currency"- class="solr.CurrencyField"- defaultCurrency="USD"- currencyConfig="bad-currency.xml"- multiValued="false"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-default-code.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-default-code.xmldeleted file mode 100644index 78d6c1fedd2..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-bogus-default-code.xml+++ /dev/null@@ -1,33 +0,0 @@-<?xml version="1.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-currency-ft-bogus-default-code" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <!-- BEGIN BAD STUFF: default -->- <fieldType name="currency"- class="solr.CurrencyField"- defaultCurrency="HOSS"- currencyConfig="currency.xml"- multiValued="false"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-code-suffix.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-code-suffix.xmldeleted file mode 100644index 7ff00b55ec9..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-code-suffix.xml+++ /dev/null@@ -1,33 +0,0 @@-<?xml version="1.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-currency-ft-code-suffix" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>-- <!-- BEGIN BAD STUFF: codeStrSuffix not allowed -->- <fieldType name="currency" class="solr.CurrencyField" codeStrSuffix="_s" multiValued="false"/>- <!-- END BAD STUFF -->-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <dyanmicField name="*_s" type="string" multiValued="false"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-multivalued.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-multivalued.xmldeleted file mode 100644index aaa4a258829..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-multivalued.xml+++ /dev/null@@ -1,29 +0,0 @@-<?xml version="1.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-currency-ft-multivalued" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <!-- BEGIN BAD STUFF: multiValued -->- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="true"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-oer-norates.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-oer-norates.xmldeleted file mode 100644index 5b50a155e3b..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-ft-oer-norates.xml+++ /dev/null@@ -1,32 +0,0 @@-<?xml version="1.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-currency-ft-oer-norates" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <!-- BEGIN BAD STUFF: no rates-->- <fieldType name="currency"- class="solr.CurrencyField"- providerClass="solr.OpenExchangeRatesOrgProvider"- multiValued="false"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <field name="money" type="currency" indexed="true" stored="true"/>-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-multivalued.xml b/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-multivalued.xmldeleted file mode 100644index c6d120585ac..00000000000--- a/solr/core/src/test-files/solr/collection1/conf/bad-schema-currency-multivalued.xml+++ /dev/null@@ -1,30 +0,0 @@-<?xml version="1.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-currency-multivalued" version="1.7">- <fieldType name="string" class="solr.StrField" multiValued="true"/>- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml"/>-- <field name="id" type="string" indexed="true" stored="true" multiValued="false"/>- <!-- BEGIN BAD STUFF: multiValued -->- <field name="money" type="currency" indexed="true" stored="true" multiValued="true"/>- <!-- END BAD STUFF -->-- <uniqueKey>id</uniqueKey>--</schema>diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml b/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xmlindex 70edcb221c2..01fc7e8792d 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema-sorts.xml@@ -117,6 +117,10 @@ NOTE: Tests expect every field in this schema to be sortable.https://issues.apache.org/jira/browse/SOLR-5354?focusedCommentId=13835891&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13835891--><dynamicField name="*" type="str" multiValued="false"/>++ <!-- Subfields used with CurrencyFieldType -->+ <dynamicField name="*_s_ns" type="str" indexed="true" stored="false" />+ <dynamicField name="*_l_ns" type="long" indexed="true" stored="false"/><copyField source="str" dest="str_last"/><copyField source="str" dest="str_first"/>@@ -264,11 +268,11 @@ NOTE: Tests expect every field in this schema to be sortable.<fieldType name="uuid_dv_first" class="solr.UUIDField" stored="true" indexed="false" docValues="true"sortMissingFirst="true"/>- <fieldType name="currency" class="solr.CurrencyField" stored="true" indexed="true" foo="bar"+ <fieldType name="currency" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" stored="true" indexed="true" foo="bar"providerClass="solr.MockExchangeRateProvider"/>- <fieldType name="currency_last" class="solr.CurrencyField" stored="true" indexed="true" foo="bar"+ <fieldType name="currency_last" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" stored="true" indexed="true" foo="bar"providerClass="solr.MockExchangeRateProvider" sortMissingLast="true"/>- <fieldType name="currency_first" class="solr.CurrencyField" stored="true" indexed="true" foo="bar"+ <fieldType name="currency_first" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" stored="true" indexed="true" foo="bar"providerClass="solr.MockExchangeRateProvider" sortMissingFirst="true"/><fieldType name="collation_en_primary" class="solr.CollationField" language="en" strength="primary" stored="true"diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-vector-catchall.xml b/solr/core/src/test-files/solr/collection1/conf/schema-vector-catchall.xmlindex 7b69316dbb7..f7031ce3f85 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema-vector-catchall.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema-vector-catchall.xml@@ -434,27 +434,6 @@<fieldType name="tenD" class="solr.PointType" dimension="10" subFieldType="double"/><fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="_d1"/>- <!-- Currency type -->- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>- <fieldType name="mock_currency" class="solr.CurrencyField" providerClass="solr.MockExchangeRateProvider" foo="bar"- multiValued="false"/>- <fieldType name="oer_currency"- class="solr.CurrencyField"- multiValued="false"- providerClass="solr.OpenExchangeRatesOrgProvider"- ratesFileLocation="open-exchange-rates.json"/>- <fieldType name="currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"- currencyConfig="currency.xml" multiValued="false"/>- <fieldType name="mock_currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"- providerClass="solr.MockExchangeRateProvider" foo="bar" multiValued="false"/>- <fieldType name="oer_currency_CFT"- class="solr.CurrencyFieldType"- amountLongSuffix="_l1_ns"- codeStrSuffix="_s1_ns"- multiValued="false"- providerClass="solr.OpenExchangeRatesOrgProvider"- ratesFileLocation="open-exchange-rates.json"/>-<!-- omitPositions example --><fieldType name="nopositions" class="solr.TextField" omitPositions="true"><analyzer>@@ -572,14 +551,6 @@<field name="home_ns" type="xy" indexed="true" stored="false" multiValued="false"/><field name="work" type="xy" indexed="true" stored="true" multiValued="false"/>- <!-- Test currency -->- <field name="amount" type="currency" indexed="true" stored="true" multiValued="false"/>- <field name="mock_amount" type="mock_currency" indexed="true" stored="true"/>- <field name="oer_amount" type="oer_currency" indexed="true" stored="true"/>- <field name="amount_CFT" type="currency_CFT" indexed="true" stored="true" multiValued="false"/>- <field name="mock_amount_CFT" type="mock_currency_CFT" indexed="true" stored="true"/>- <field name="oer_amount_CFT" type="oer_currency_CFT" indexed="true" stored="true"/>-<!-- test different combinations of indexed and stored --><field name="bind" type="boolean" indexed="true" stored="false"/><field name="bsto" type="boolean" indexed="false" stored="true"/>diff --git a/solr/core/src/test-files/solr/collection1/conf/schema.xml b/solr/core/src/test-files/solr/collection1/conf/schema.xmlindex c0446bbf33a..b824c77460f 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema.xml@@ -436,15 +436,7 @@<fieldType name="tenD" class="solr.PointType" dimension="10" subFieldType="double"/><fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="_d1"/>- <!-- Currency type -->- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>- <fieldType name="mock_currency" class="solr.CurrencyField" providerClass="solr.MockExchangeRateProvider" foo="bar"- multiValued="false"/>- <fieldType name="oer_currency"- class="solr.CurrencyField"- multiValued="false"- providerClass="solr.OpenExchangeRatesOrgProvider"- ratesFileLocation="open-exchange-rates.json"/>+ <!-- Currency type --><fieldType name="currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"currencyConfig="currency.xml" multiValued="false"/><fieldType name="mock_currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"@@ -575,9 +567,6 @@<field name="work" type="xy" indexed="true" stored="true" multiValued="false"/><!-- Test currency -->- <field name="amount" type="currency" indexed="true" stored="true" multiValued="false"/>- <field name="mock_amount" type="mock_currency" indexed="true" stored="true"/>- <field name="oer_amount" type="oer_currency" indexed="true" stored="true"/><field name="amount_CFT" type="currency_CFT" indexed="true" stored="true" multiValued="false"/><field name="mock_amount_CFT" type="mock_currency_CFT" indexed="true" stored="true"/><field name="oer_amount_CFT" type="oer_currency_CFT" indexed="true" stored="true"/>diff --git a/solr/core/src/test-files/solr/collection1/conf/schema12.xml b/solr/core/src/test-files/solr/collection1/conf/schema12.xmlindex 16be4aa17cd..3cd370786ac 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema12.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema12.xml@@ -560,8 +560,8 @@<fieldType name="location" class="solr.LatLonPointSpatialField" />- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>-+ <fieldType name="currency" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" currencyConfig="currency.xml" multiValued="false"/>+<fieldType name="shingle23" class="solr.TextField" enableGraphQueries="false" multiValued="true"><analyzer><tokenizer class="solr.WhitespaceTokenizerFactory"/>@@ -773,6 +773,10 @@<dynamicField name="*_f_norms" type="float" indexed="true" stored="true" omitNorms="false" docValues="false"/><dynamicField name="*_d_norms" type="double" indexed="true" stored="true" omitNorms="false" docValues="false"/>+ <!-- Subfields used with CurrencyFieldType -->+ <dynamicField name="*_s_ns" type="string" indexed="true" stored="false" />+ <dynamicField name="*_l_ns" type="long" indexed="true" stored="false"/>+<dynamicField name="ignored_*" type="ignored" multiValued="true"/><dynamicField name="attr_*" type="text" indexed="true" stored="true" multiValued="true"/>diff --git a/solr/core/src/test-files/solr/collection1/conf/schema15.xml b/solr/core/src/test-files/solr/collection1/conf/schema15.xmlindex 1efddf09d85..aefea6f106c 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema15.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema15.xml@@ -40,7 +40,7 @@<fieldType name="tfloat" class="${solr.tests.FloatFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="8" positionIncrementGap="0"/><fieldType name="tlong" class="${solr.tests.LongFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="8" positionIncrementGap="0"/><fieldType name="tdouble" class="${solr.tests.DoubleFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="8" positionIncrementGap="0"/>- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>+ <fieldType name="currency" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" currencyConfig="currency.xml" multiValued="false"/><fieldType name="rank" class="solr.RankField"/><!-- Dense Vector Fields -->@@ -612,6 +612,10 @@<dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/><dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>+ <!-- Subfields used with CurrencyFieldType -->+ <dynamicField name="*_s_ns" type="string" indexed="true" stored="false" />+ <dynamicField name="*_l_ns" type="long" indexed="true" stored="false"/>+<dynamicField name="ignored_*" type="ignored" multiValued="true"/><dynamicField name="attr_*" type="text" indexed="true" stored="true" multiValued="true"/>diff --git a/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml b/solr/core/src/test-files/solr/collection1/conf/schema_latest.xmlindex 87053fbd6ce..fcd25960ec6 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema_latest.xml@@ -252,6 +252,10 @@<dynamicField name="*_c" type="currency" indexed="true" stored="true"/>+ <!-- Subfields used with CurrencyFieldType -->+ <dynamicField name="*_s_ns" type="string" indexed="true" stored="false" />+ <dynamicField name="*_l_ns" type="long" indexed="true" stored="false"/>+<dynamicField name="ignored_*" type="ignored" multiValued="true"/><dynamicField name="attr_*" type="text_general" indexed="true" stored="true" multiValued="true"/>@@ -726,7 +730,7 @@ratesFileLocation: URL or path to rates JSON file (default latest.json on the web)refreshInterval: Number of minutes between each rates fetch (default: 1440, min: 60)-->- <fieldType name="currency" class="solr.CurrencyField" precisionStep="8" defaultCurrency="USD"+ <fieldType name="currency" class="solr.CurrencyFieldType" amountLongSuffix="_l_ns" codeStrSuffix="_s_ns" defaultCurrency="USD"currencyConfig="currency.xml"/><fieldType name="severityType" class="solr.EnumFieldType" enumsConfig="enumsConfig.xml" enumName="severity"/>diff --git a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.javaindex 7cb358f6904..ad318de1650 100644--- a/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java+++ b/solr/core/src/test/org/apache/solr/response/JSONWriterTest.java@@ -355,8 +355,6 @@ public class JSONWriterTest extends SolrTestCaseJ4 {"true","isto","42",- "amount",- "100,USD","price","3.14","severity",@@ -380,7 +378,6 @@ public class JSONWriterTest extends SolrTestCaseJ4 {+ " \"uuid\":[\"6e2fb55b-dd42-4e2d-84ca-71a599403aa3\"],\n"+ " \"bsto\":[true],\n"+ " \"isto\":[42],\n"- + " \"amount\":\"100,USD\",\n"+ " \"price\":3.14,\n"+ " \"severity\":\"High\",\n"+ " \"dateRange\":[\"[2024-03-01 TO 2024-03-31]\"],\n"diff --git a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.javaindex d31246de518..3f3e372399a 100644--- a/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java+++ b/solr/core/src/test/org/apache/solr/schema/BadIndexSchemaTest.java@@ -64,9 +64,6 @@ public class BadIndexSchemaTest extends AbstractBadConfigTestBase {}public void testMultivaluedCurrency() throws Exception {- doTest("bad-schema-currency-ft-multivalued.xml", "types can not be multiValued: currency");- doTest("bad-schema-currency-multivalued.xml", "fields can not be multiValued: money");- doTest("bad-schema-currency-dynamic-multivalued.xml", "fields can not be multiValued: *_c");doTest("bad-schema-currencyfieldtype-ft-multivalued.xml","types can not be multiValued: currency");@@ -77,22 +74,14 @@ public class BadIndexSchemaTest extends AbstractBadConfigTestBase {}public void testCurrencyOERNoRates() throws Exception {- doTest("bad-schema-currency-ft-oer-norates.xml", "ratesFileLocation");doTest("bad-schema-currencyfieldtype-ft-oer-norates.xml", "ratesFileLocation");}public void testCurrencyBogusCode() throws Exception {- doTest("bad-schema-currency-ft-bogus-default-code.xml", "HOSS");- doTest("bad-schema-currency-ft-bogus-code-in-xml.xml", "HOSS");doTest("bad-schema-currencyfieldtype-ft-bogus-default-code.xml", "HOSS");doTest("bad-schema-currencyfieldtype-ft-bogus-code-in-xml.xml", "HOSS");}- public void testCurrencyDisallowedSuffixParams() throws Exception {- doTest("bad-schema-currency-ft-code-suffix.xml", "Unknown parameter(s)");- doTest("bad-schema-currency-ft-amount-suffix.xml", "Unknown parameter(s)");- }-public void testCurrencyBogusSuffixes() throws Exception {doTest("bad-schema-currencyfieldtype-bogus-code-suffix.xml",diff --git a/solr/core/src/test/org/apache/solr/schema/CurrencyFieldTypeTest.java b/solr/core/src/test/org/apache/solr/schema/CurrencyFieldTypeTest.javaindex 58eb8ccfdab..e6de7a7efd5 100644--- a/solr/core/src/test/org/apache/solr/schema/CurrencyFieldTypeTest.java+++ b/solr/core/src/test/org/apache/solr/schema/CurrencyFieldTypeTest.java@@ -45,13 +45,11 @@ public class CurrencyFieldTypeTest extends SolrTestCaseJ4 {this.expectedProviderClass = expectedProviderClass;}+ // remove cft later@ParametersFactorypublic static Iterable<Object[]> parameters() {return Arrays.asList(new Object[][] {- {"amount", FileExchangeRateProvider.class}, // CurrencyField- {"mock_amount", MockExchangeRateProvider.class}, // CurrencyField- {"oer_amount", OpenExchangeRatesOrgProvider.class}, // CurrencyField{"amount_CFT", FileExchangeRateProvider.class}, // CurrencyFieldType{"mock_amount_CFT", MockExchangeRateProvider.class}, // CurrencyFieldType{"oer_amount_CFT", OpenExchangeRatesOrgProvider.class} // CurrencyFieldType@@ -87,14 +85,8 @@ public class CurrencyFieldTypeTest extends SolrTestCaseJ4 {assertTrue(amount.isPolyField());CurrencyFieldType type = (CurrencyFieldType) amount.getType();- String currencyDynamicField =- "*"- + (type instanceof CurrencyField ? FieldType.POLY_FIELD_SEPARATOR : "")- + type.fieldSuffixCurrency;- String amountDynamicField =- "*"- + (type instanceof CurrencyField ? FieldType.POLY_FIELD_SEPARATOR : "")- + type.fieldSuffixAmountRaw;+ String currencyDynamicField = "*" + type.fieldSuffixCurrency;+ String amountDynamicField = "*" + type.fieldSuffixAmountRaw;SchemaField[] dynFields = schema.getDynamicFieldPrototypes();boolean seenCurrency = false;diff --git a/solr/prometheus-exporter/src/test-files/exampledocs/money.xml b/solr/prometheus-exporter/src/test-files/exampledocs/money.xmlindex b1b8036c369..e889c18bdce 100644--- a/solr/prometheus-exporter/src/test-files/exampledocs/money.xml+++ b/solr/prometheus-exporter/src/test-files/exampledocs/money.xml@@ -15,7 +15,7 @@limitations under the License.-->-<!-- Example documents utilizing the CurrencyField type -->+<!-- Example documents utilizing the CurrencyFieldType type --><add><doc><field name="id">USD</field>diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/field-types-included-with-solr.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/field-types-included-with-solr.adocindex d29f74cc7b3..101e391f7ae 100644--- a/solr/solr-ref-guide/modules/indexing-guide/pages/field-types-included-with-solr.adoc+++ b/solr/solr-ref-guide/modules/indexing-guide/pages/field-types-included-with-solr.adoc@@ -93,8 +93,6 @@ This shortcoming may be addressed in a future release.|===|Class |Description-|CurrencyField |Use CurrencyFieldType instead.-|EnumField |Use EnumFieldType instead.|TrieDateField |Use DatePointField instead.diff --git a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adocindex 972106a63fb..eeb1ff958f5 100644--- a/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc+++ b/solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-10.adoc@@ -106,6 +106,8 @@ Users who that don't need to vary JAR access on a per-core basis have several op* ExternalFileField field type has been removed.+* CurrencyField has been removed. Users should migrate to the `CurrencyFieldType` implementation.+=== Security* There is no longer a distinction between trusted and untrusted configSets; all configSets are now considered trusted. To ensure security, Solr should be properly protected using authentication and authorization mechanisms, allowing only authorized users with administrative privileges to publish them.diff --git a/solr/test-framework/src/test-files/solr/collection1/conf/schema.xml b/solr/test-framework/src/test-files/solr/collection1/conf/schema.xmlindex b4174377b26..2b9ae1f053d 100644--- a/solr/test-framework/src/test-files/solr/collection1/conf/schema.xml+++ b/solr/test-framework/src/test-files/solr/collection1/conf/schema.xml@@ -437,14 +437,6 @@<fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="_d1"/><!-- Currency type -->- <fieldType name="currency" class="solr.CurrencyField" currencyConfig="currency.xml" multiValued="false"/>- <fieldType name="mock_currency" class="solr.CurrencyField" providerClass="solr.MockExchangeRateProvider" foo="bar"- multiValued="false"/>- <fieldType name="oer_currency"- class="solr.CurrencyField"- multiValued="false"- providerClass="solr.OpenExchangeRatesOrgProvider"- ratesFileLocation="open-exchange-rates.json"/><fieldType name="currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"currencyConfig="currency.xml" multiValued="false"/><fieldType name="mock_currency_CFT" class="solr.CurrencyFieldType" amountLongSuffix="_l1_ns" codeStrSuffix="_s1"