-
Notifications
You must be signed in to change notification settings - Fork 739
removing check in TextToVectorUpdateProcessorFactory which brakes update for new dynamic fields #3426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removing check in TextToVectorUpdateProcessorFactory which brakes update for new dynamic fields #3426
Changes from all commits
f91f287
285a6ef
5cec14e
20b1174
94d60a5
997376c
a6a45e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import org.apache.solr.common.SolrInputDocument; | ||
import org.apache.solr.llm.TestLlmBase; | ||
import org.apache.solr.llm.textvectorisation.store.rest.ManagedTextToVectorModelStore; | ||
import org.junit.After; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
@@ -40,6 +41,13 @@ public static void cleanup() throws Exception { | |
afterTest(); | ||
} | ||
|
||
@After | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the deletion within the test method will not happen if a test fails, such a failing test was then impacting all following test since the deletion was not done and the setup is done only once for the test-class There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes sense, have you checked that all is fine? I remember I struggled a bit with the after/afterClass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
public void afterEachTest() throws Exception { | ||
restTestHarness.delete(ManagedTextToVectorModelStore.REST_END_POINT + "/dummy-1"); | ||
restTestHarness.delete( | ||
ManagedTextToVectorModelStore.REST_END_POINT + "/exception-throwing-model"); // clean | ||
} | ||
|
||
@Test | ||
public void processAdd_inputField_shouldVectoriseInputField() throws Exception { | ||
loadModel("dummy-model.json"); // preparation | ||
|
@@ -50,10 +58,7 @@ public void processAdd_inputField_shouldVectoriseInputField() throws Exception { | |
"textToVector"); | ||
assertU(commit()); | ||
|
||
final String solrQuery = "*:*"; | ||
final SolrQuery query = new SolrQuery(); | ||
query.setQuery(solrQuery); | ||
query.add("fl", "id,vector"); | ||
final SolrQuery query = getSolrQuery(); | ||
|
||
assertJQ( | ||
"/query" + query.toQueryString(), | ||
|
@@ -66,6 +71,14 @@ public void processAdd_inputField_shouldVectoriseInputField() throws Exception { | |
restTestHarness.delete(ManagedTextToVectorModelStore.REST_END_POINT + "/dummy-1"); // clean up | ||
} | ||
|
||
private SolrQuery getSolrQuery() { | ||
final String solrQuery = "*:*"; | ||
final SolrQuery query = new SolrQuery(); | ||
query.setQuery(solrQuery); | ||
query.add("fl", "id,vector"); | ||
return query; | ||
} | ||
|
||
/* | ||
This test looks for the 'dummy-1' model, but such model is not loaded, the model store is empty, so the update fails | ||
*/ | ||
|
@@ -93,10 +106,7 @@ public void processAdd_emptyInputField_shouldLogAndIndexWithNoVector() throws Ex | |
addWithChain(sdoc("id", "98", "_text_", "Vegeta is the saiyan prince."), "textToVector"); | ||
assertU(commit()); | ||
|
||
final String solrQuery = "*:*"; | ||
final SolrQuery query = new SolrQuery(); | ||
query.setQuery(solrQuery); | ||
query.add("fl", "id,vector"); | ||
final SolrQuery query = getSolrQuery(); | ||
|
||
assertJQ( | ||
"/query" + query.toQueryString(), | ||
|
@@ -116,10 +126,7 @@ public void processAdd_nullInputField_shouldLogAndIndexWithNoVector() throws Exc | |
assertU(adoc("id", "98")); | ||
assertU(commit()); | ||
|
||
final String solrQuery = "*:*"; | ||
final SolrQuery query = new SolrQuery(); | ||
query.setQuery(solrQuery); | ||
query.add("fl", "id,vector"); | ||
final SolrQuery query = getSolrQuery(); | ||
|
||
assertJQ( | ||
"/query" + query.toQueryString(), | ||
|
@@ -141,10 +148,7 @@ public void processAdd_failingVectorisation_shouldLogAndIndexWithNoVector() thro | |
"failingTextToVector"); | ||
assertU(commit()); | ||
|
||
final String solrQuery = "*:*"; | ||
final SolrQuery query = new SolrQuery(); | ||
query.setQuery(solrQuery); | ||
query.add("fl", "id,vector"); | ||
final SolrQuery query = getSolrQuery(); | ||
|
||
assertJQ( | ||
"/query" + query.toQueryString(), | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing my own DimensionAwareEmbeddingModel, I notice that if the attribute is not supported by the model, the error was not logged at all and I had to debug to see what the issue was.
I also took the liberty tot clean up the duplicate code snippets.