Skip to content

Conversation

@dev-jonghoonpark
Copy link
Contributor

related issue: #3535

Currently, the meta field prefix in the Weaviate vector store cannot be modified.
This PR has been improved to make it configurable, and relevant tests have been added.

changes

  • Added a new property: spring.ai.vectorstore.weaviate.meta-field-prefix
    • Note: Whitespace is also allowed in this property.

@dev-jonghoonpark dev-jonghoonpark force-pushed the GH-3535-make-meta-field-prefix-configurable branch 2 times, most recently from b02e7e5 to 063af91 Compare June 18, 2025 07:54
Comment on lines +53 to +60
public String getMetaFieldPrefix() {
return metaFieldPrefix;
}

public void setMetaFieldPrefix(String metaFieldPrefix) {
Assert.notNull(metaFieldPrefix, "metaFieldPrefix can be empty but not null");
this.metaFieldPrefix = metaFieldPrefix;
}
Copy link
Contributor Author

@dev-jonghoonpark dev-jonghoonpark Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods are newly created, but since the class Javadoc already includes the @since 1.1.0 tag, the @since tag was not added to the methods.

@ilayaperumalg ilayaperumalg modified the milestone: 1.1.x Jun 18, 2025
@dev-jonghoonpark dev-jonghoonpark force-pushed the GH-3535-make-meta-field-prefix-configurable branch from 063af91 to af2e107 Compare June 18, 2025 09:53
@dev-jonghoonpark
Copy link
Contributor Author

fixed conflict with #3582

@sobychacko sobychacko self-assigned this Jun 18, 2025

@ParameterizedTest(name = "{0} : {displayName} ")
@ValueSource(strings = { "custom_", "" })
public void addAndSearchWithCustomMetaFieldPrefix(String metaFieldPrefix) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help me understand where the configurable metadata prefix is used in this test and then assert that it takes effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobychacko

In this test, the following behavior is expected:

  1. Verify that data is stored and retrieved correctly using a customVectorStore with a modified prefix.
  2. Confirm that data cannot be retrieved using a vectorStore with the default prefix (as the prefixes differ, retrieval should fail).
  3. Remove the data from the customVectorStore to ensure it does not affect subsequent tests.

If there’s a better approach, I’m open to suggestions for improvement. 👍

@sobychacko
Copy link
Contributor

@dev-jonghoonpark Some minor comments. In your description above, I see a note that the white spaces are also allowed with the metadata prefix. I don't see that in the code. Could you point me to where that is addressed? Thanks!

@dev-jonghoonpark
Copy link
Contributor Author

@sobychacko

In WeaviateVectorStoreOptions, validation in setMetaFieldPrefix was implemented to use hasNull instead of hasText.

To verify that this works as expected, a test case with an empty metaFieldPrefix ("") has been added to addAndSearchWithCustomMetaFieldPrefix in WeaviateVectorStoreIT.

Is there anything I might have missed?

…erties

Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
@dev-jonghoonpark dev-jonghoonpark force-pushed the GH-3535-make-meta-field-prefix-configurable branch from af2e107 to 3d0455d Compare June 19, 2025 00:58
@sobychacko sobychacko self-requested a review June 25, 2025 16:58
@sobychacko sobychacko merged commit e86ce73 into spring-projects:main Jun 25, 2025
2 checks passed
scionaltera pushed a commit to scionaltera/spring-ai that referenced this pull request Sep 3, 2025
…erties (spring-projects#3585)

Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
chedim pushed a commit to couchbaselabs/spring-ai that referenced this pull request Sep 19, 2025
…erties (spring-projects#3585)

Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants