This is an automated email from the ASF dual-hosted git repository.
hossman pushed a commit to branch jira/SOLR-17975
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/jira/SOLR-17975 by this push:
new 63544274f66 Beef up tests and resolve some nocommits
63544274f66 is described below
commit 63544274f6629a4a91235166505b0b3118bb2f82
Author: Chris Hostetter <[email protected]>
AuthorDate: Tue Jan 13 15:47:21 2026 -0700
Beef up tests and resolve some nocommits
---
.../solr/schema/LateInteractionVectorField.java | 4 +-
.../conf/bad-schema-late-vec-field-multivalued.xml | 27 +++++++++++
.../schema/TestLateInteractionVectorFieldInit.java | 2 +
.../solr/search/TestLateInteractionVectors.java | 54 ++++++++++++++++++++--
4 files changed, 82 insertions(+), 5 deletions(-)
diff --git
a/solr/core/src/java/org/apache/solr/schema/LateInteractionVectorField.java
b/solr/core/src/java/org/apache/solr/schema/LateInteractionVectorField.java
index fba037e5b20..10ea9f1939a 100644
--- a/solr/core/src/java/org/apache/solr/schema/LateInteractionVectorField.java
+++ b/solr/core/src/java/org/apache/solr/schema/LateInteractionVectorField.java
@@ -309,7 +309,7 @@ public class LateInteractionVectorField extends FieldType {
public ValueSource getValueSource(SchemaField field, QParser parser) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST,
- getClass().getSimpleName() + " not supported for function queries.");
+ getClass().getSimpleName() + " not supported for function queries, use
lateVector() function.");
}
/** Not supported */
@@ -317,7 +317,7 @@ public class LateInteractionVectorField extends FieldType {
public Query getFieldQuery(QParser parser, SchemaField field, String
externalVal) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST,
- "nocommit: better error msgs citing value source parser once it
exists");
+ getClass().getSimpleName() + " not supported for field queries, use
lateVector() function.");
}
/** Not Supported */
diff --git
a/solr/core/src/test-files/solr/collection1/conf/bad-schema-late-vec-field-multivalued.xml
b/solr/core/src/test-files/solr/collection1/conf/bad-schema-late-vec-field-multivalued.xml
new file mode 100644
index 00000000000..086e3a5d1ee
--- /dev/null
+++
b/solr/core/src/test-files/solr/collection1/conf/bad-schema-late-vec-field-multivalued.xml
@@ -0,0 +1,27 @@
+<?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" version="1.7">
+
+ <field name="bad_field" type="late" multiValued="true" />
+
+ <fieldType name="late" class="solr.LateInteractionVectorField"
vectorDimension="4" />
+ <fieldType name="string" class="solr.StrField" multiValued="true"/>
+ <field name="id" type="string" indexed="true" stored="true"
multiValued="false" required="false"/>
+ <uniqueKey>id</uniqueKey>
+</schema>
diff --git
a/solr/core/src/test/org/apache/solr/schema/TestLateInteractionVectorFieldInit.java
b/solr/core/src/test/org/apache/solr/schema/TestLateInteractionVectorFieldInit.java
index e7c14e9d1ca..cda86969dc0 100644
---
a/solr/core/src/test/org/apache/solr/schema/TestLateInteractionVectorFieldInit.java
+++
b/solr/core/src/test/org/apache/solr/schema/TestLateInteractionVectorFieldInit.java
@@ -47,6 +47,8 @@ public class TestLateInteractionVectorFieldInit extends
AbstractBadConfigTestBas
"solrconfig-basic.xml", "bad-schema-late-vec-field-nodv.xml",
"docValues: bad_field");
assertConfigs(
"solrconfig-basic.xml", "bad-schema-late-vec-field-indexed.xml",
"indexed: bad_field");
+ assertConfigs(
+ "solrconfig-basic.xml", "bad-schema-late-vec-field-multivalued.xml",
"multiValued: bad_field");
}
public void test_SchemaFields() throws Exception {
diff --git
a/solr/core/src/test/org/apache/solr/search/TestLateInteractionVectors.java
b/solr/core/src/test/org/apache/solr/search/TestLateInteractionVectors.java
index 26b18eaa964..e9a2dc4a958 100644
--- a/solr/core/src/test/org/apache/solr/search/TestLateInteractionVectors.java
+++ b/solr/core/src/test/org/apache/solr/search/TestLateInteractionVectors.java
@@ -24,8 +24,15 @@ import static org.hamcrest.Matchers.startsWith;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import org.apache.lucene.document.LateInteractionField;
+import org.apache.lucene.document.StoredField;
+import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.VectorSimilarityFunction;
import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.schema.FieldType;
+import org.apache.solr.schema.LateInteractionVectorField;
+import org.apache.solr.schema.SchemaField;
import org.junit.After;
import org.junit.Before;
@@ -134,8 +141,49 @@ public class TestLateInteractionVectors extends
SolrTestCaseJ4 {
// nocommit: other kinds of decoding errors to check for?
}
- // nocommit: add whitebox test of createFields
+ /** Low level test of createFields */
+ public void createFields() throws Exception {
+ final Map<String,float[][]> data = Map.of("[[1,2,3,4]]",
+ new float[][] { { 1F, 2F, 3F, 4F
}},
+ "[[1,2,3,4],[5,6,7,8]]",
+ new float[][] { { 1F, 2F, 3F, 4F
}, { 5F, 6F, 7F, 8F }});
+ try (SolrQueryRequest r = req()) {
+ // defaults with stored + doc values
+ for (String input : data.keySet()) {
+ final SchemaField f = r.getSchema().getField("lv_4_def");
+ final float[][] expected = data.get(input);
+ final List<IndexableField> actual = f.getType().createFields(f, input);
+ assertEquals(2, actual.size());
+
+ if (actual.get(0) instanceof LateInteractionField lif) {
+ assertEquals(expected, lif.getValue());
+ } else {
+ fail("first Field isn't a LIF: " + actual.get(0).getClass());
+ }
+ if (actual.get(1) instanceof StoredField stored) {
+ assertEquals(input, stored.stringValue());
+ } else {
+ fail("second Field isn't stored: " + actual.get(1).getClass());
+ }
+ }
+
+ // stored=false, only doc values
+ for (String input : data.keySet()) {
+ final SchemaField f = r.getSchema().getField("lv_4_nostored");
+ final float[][] expected = data.get(input);
+ final List<IndexableField> actual = f.getType().createFields(f, input);
+ assertEquals(1, actual.size());
+
+ if (actual.get(0) instanceof LateInteractionField lif) {
+ assertEquals(expected, lif.getValue());
+ } else {
+ fail("first Field isn't a LIF: " + actual.get(0).getClass());
+ }
+ }
+ }
+ }
+
public void testSimpleIndexAndRetrieval() throws Exception {
// for simplicity, use a single doc, with identical values in several
fields
@@ -196,8 +244,8 @@ public class TestLateInteractionVectors extends
SolrTestCaseJ4 {
"//str[@name='lv_4_cosine'][.='" + d4s + "']",
// dv only non-stored fields
- "//str[@name='lv_3_nostored'][.='"+d3s+"']", // nocommit: requires
SOLR-18033.patch be applied
- "//str[@name='lv_4_nostored'][.='"+d4s+"']", // nocommit: requires
SOLR-18033.patch be applied
+ "//str[@name='lv_3_nostored'][.='"+d3s+"']",
+ "//str[@name='lv_4_nostored'][.='"+d4s+"']",
// function computations
"//float[@name='euclid_3_def'][.=" + euclid3 + "]",