ilariapet commented on code in PR #3919:
URL: https://github.com/apache/solr/pull/3919#discussion_r2610482339
##########
solr/modules/language-models/src/test/org/apache/solr/languagemodels/textvectorisation/update/processor/TextToVectorUpdateProcessorTest.java:
##########
@@ -162,6 +163,104 @@ public void
processAdd_failingVectorisation_shouldLogAndIndexWithNoVector() thro
ManagedTextToVectorModelStore.REST_END_POINT +
"/exception-throwing-model"); // clean up
}
+ @Test
+ public void
processAtomicUpdate_shouldTriggerTheVectorizationAndFetchTheStoredContent()
+ throws Exception {
+ // Verifies that when using a processor chain configured for partial
updates
+ // (i.e., the UpdateRequestProcessor is placed before the TextToVector
processor),
+ // the system correctly retrieves the stored value of the input field
(_text_)
+ // and generates the vector for the document.
+ loadModel("dummy-model.json");
+ assertU(adoc("id", "99", "_text_", "Vegeta is the saiyan prince."));
+ assertU(adoc("id", "98", "_text_", "Kakaroth is a saiyan grown up on
planet Earth."));
+ assertU(commit());
+
+ SolrInputDocument atomic_doc = new SolrInputDocument();
+ atomic_doc.setField("id", "99");
+ atomic_doc.setField("vectorised", Map.of("set", "true"));
+ addWithChain(
+ atomic_doc, "textToVectorPartialUpdates"); // use the chain that
supports partial updates
+ assertU(commit());
+
+ final SolrQuery query = getSolrQuery();
+
+ assertJQ(
+ "/query" + query.toQueryString(),
+ "/response/numFound==2]",
+ "/response/docs/[0]/id=='98'",
+ "!/response/docs/[0]/vector==", // no vector field for document 98
+ "/response/docs/[1]/id=='99'",
+ "/response/docs/[1]/vector==[1.0, 2.0, 3.0, 4.0]");
+
+ restTestHarness.delete(ManagedTextToVectorModelStore.REST_END_POINT +
"/dummy-1"); // clean up
+ }
+
+ @Test
+ public void
processAtomicUpdate_withoutDistributedUpdateProcessorFactory_shouldNotCreateVector()
Review Comment:
Yes, this test was mainly useful for me while debugging the issue. I’m fine
with removing it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]