This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new f4d629042a5 SOLR-18361: Remove LegacyFieldValueFeature (contrib/ltr)
(#4791)
f4d629042a5 is described below
commit f4d629042a5c439abea986a0f3328f9b7ad1aeee
Author: Serhiy Bzhezytskyy <[email protected]>
AuthorDate: Mon Aug 24 23:17:59 2026 +0300
SOLR-18361: Remove LegacyFieldValueFeature (contrib/ltr) (#4791)
---
.../SOLR-18361-remove-legacyfieldvaluefeature.yml | 9 +++
.../apache/solr/ltr/feature/FieldValueFeature.java | 3 -
.../solr/ltr/feature/LegacyFieldValueFeature.java | 58 ---------------
.../ltr/feature/TestLegacyFieldValueFeature.java | 84 ----------------------
4 files changed, 9 insertions(+), 145 deletions(-)
diff --git a/changelog/unreleased/SOLR-18361-remove-legacyfieldvaluefeature.yml
b/changelog/unreleased/SOLR-18361-remove-legacyfieldvaluefeature.yml
new file mode 100644
index 00000000000..3f4197d88df
--- /dev/null
+++ b/changelog/unreleased/SOLR-18361-remove-legacyfieldvaluefeature.yml
@@ -0,0 +1,9 @@
+title: >
+ Removed the deprecated `org.apache.solr.ltr.feature.LegacyFieldValueFeature`
LTR feature class,
+ deprecated since 9.4 in favor of `FieldValueFeature`, which now has
equivalent behavior.
+type: removed
+authors:
+ - name: Serhiy Bzhezytskyy
+links:
+ - name: SOLR-18361
+ url: https://issues.apache.org/jira/browse/SOLR-18361
diff --git
a/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
b/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
index 4e50dbd0c79..5b5a4dae0fd 100644
---
a/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
+++
b/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/FieldValueFeature.java
@@ -64,9 +64,6 @@ import org.apache.solr.search.SolrIndexSearcher;
*
* <p>DefaultValueFVFS: used for docValues=true, a fallback scorer that is
used on segments where no
* document has a value set in the field of this feature
- *
- * <p>Use {@link LegacyFieldValueFeature} for the pre 9.4 behaviour of not
using DocValues when
- * docValues=true is combined with stored=true.
*/
public class FieldValueFeature extends Feature {
diff --git
a/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/LegacyFieldValueFeature.java
b/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/LegacyFieldValueFeature.java
deleted file mode 100644
index 868059f6cc3..00000000000
---
a/solr/modules/ltr/src/java/org/apache/solr/ltr/feature/LegacyFieldValueFeature.java
+++ /dev/null
@@ -1,58 +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.ltr.feature;
-
-import java.util.Map;
-
-/**
- * This feature returns the value of a field in the current document. The
field must have
- * stored="true" or docValues="true" properties. Example configuration:
- *
- * <pre>
- * {
- * "name": "rawHits",
- * "class": "org.apache.solr.ltr.feature.LegacyFieldValueFeature",
- * "params": {
- * "field": "hits"
- * }
- * }
- * </pre>
- *
- * <p>There are 4 different types of FeatureScorers that a
FieldValueFeatureWeight may use. The
- * chosen scorer depends on the field attributes.
- *
- * <p>FieldValueFeatureScorer (FVFS): used for stored=true, no matter if
docValues=true or
- * docValues=false
- *
- * <p>NumericDocValuesFVFS: used for stored=false and docValues=true, if
docValueType == NUMERIC
- *
- * <p>SortedDocValuesFVFS: used for stored=false and docValues=true, if
docValueType == SORTED
- *
- * <p>DefaultValueFVFS: used for stored=false and docValues=true, a fallback
scorer that is used on
- * segments where no document has a value set in the field of this feature
- *
- * <p>Matches {@link FieldValueFeature} behaviour prior to 9.4 i.e. DocValues
are not used when
- * docValues=true is combined with stored=true.
- */
-@Deprecated(since = "9.4")
-public class LegacyFieldValueFeature extends FieldValueFeature {
-
- public LegacyFieldValueFeature(String name, Map<String, Object> params) {
- super(name, params);
- this.useDocValuesForStored = false;
- }
-}
diff --git
a/solr/modules/ltr/src/test/org/apache/solr/ltr/feature/TestLegacyFieldValueFeature.java
b/solr/modules/ltr/src/test/org/apache/solr/ltr/feature/TestLegacyFieldValueFeature.java
deleted file mode 100644
index 16374234af8..00000000000
---
a/solr/modules/ltr/src/test/org/apache/solr/ltr/feature/TestLegacyFieldValueFeature.java
+++ /dev/null
@@ -1,84 +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.ltr.feature;
-
-import java.util.Map;
-import org.junit.Test;
-
-@Deprecated
-public class TestLegacyFieldValueFeature extends TestFieldValueFeature {
-
- @Override
- protected String getFieldValueFeatureClassName() {
- return LegacyFieldValueFeature.class.getName();
- }
-
- @Override
- protected String getObservingFieldValueFeatureClassName() {
- return LegacyObservingFieldValueFeature.class.getName();
- }
-
- @Deprecated
- public static final class LegacyObservingFieldValueFeature
- extends TestFieldValueFeature.ObservingFieldValueFeature {
-
- public LegacyObservingFieldValueFeature(String name, Map<String, Object>
params) {
- super(name, params);
- this.useDocValuesForStored = false;
- }
- }
-
- @Override
- protected String storedDvIsTrendy_FieldValueFeatureScorer_className() {
- return
FieldValueFeature.FieldValueFeatureWeight.FieldValueFeatureScorer.class.getName();
- }
-
- @Test
- public void
test_LegacyFieldValueFeature_behavesDifferentlyThan_FieldValueFeature()
- throws Exception {
- // the field storedDvIsTrendy has stored=true and docValues=true
- final String field = "storedDvIsTrendy";
-
- // demonstrate that & how the FieldValueFeature & LegacyFieldValueFeature
implementations differ
-
- // the LegacyFieldValueFeature does not use docValues
- String usedScorerClass =
loadAndQuery(getObservingFieldValueFeatureClassName(), field);
- assertEquals(
-
FieldValueFeature.FieldValueFeatureWeight.FieldValueFeatureScorer.class.getName(),
- usedScorerClass);
-
- // the FieldValueFeature does use docValues
- usedScorerClass =
loadAndQuery(super.getObservingFieldValueFeatureClassName(), field);
- assertEquals(
-
FieldValueFeature.FieldValueFeatureWeight.SortedDocValuesFieldValueFeatureScorer.class
- .getName(),
- usedScorerClass);
- }
-
- private String loadAndQuery(String featureClassName, String field) throws
Exception {
- final String modelName = field + "-model-" + featureClassName;
- final String featureStoreName =
-
"test_LegacyFieldValueFeature_behavesDifferentlyThan_FieldValueFeature_"
- + field
- + "_"
- + featureClassName;
-
- loadFeatureAndModel(featureClassName, field, featureStoreName, modelName);
-
- return addAndQueryId21(field, modelName, "1");
- }
-}