Fixes #564: Add Neo4j vector search using 2026.01 syntax and in-index filtering#565
Open
vga91 wants to merge 2 commits intolangchain4j:mainfrom
Open
Fixes #564: Add Neo4j vector search using 2026.01 syntax and in-index filtering#565vga91 wants to merge 2 commits intolangchain4j:mainfrom
vga91 wants to merge 2 commits intolangchain4j:mainfrom
Conversation
Martin7-1
reviewed
Feb 15, 2026
Collaborator
Martin7-1
left a comment
There was a problem hiding this comment.
@vga91 Thanks for your contribution!
I think that hardcoding if-else statements into the embedding store will reduce scalability, and maintenance will be very troublesome if new SearchType is added later. Is it possible to implement the logic for different search types using a separate SearchStrategy (e.g. VectorFunctionSearchStrategy and MatchSearchClauseSearchStrategy), so that if Neo4j has new updates, users can also implement their own SearchStrategy?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #564
Change
This PR updates the
Neo4jEmbeddingStoreto support the new Vector Search syntax introduced in Neo4j version 2026.01 (Preview), enabling native in-index filtering.Implementation Details:
New
SearchTypeConfiguration:Introduced a
SearchTypeenum to control the retrieval strategy:VECTOR_FUNCTION(Default): Uses legacydb.index.vector.queryNodesor cosine similarity functions. Compatible with Neo4j 5.x.MATCH_SEARCH_CLAUSE: Enables the new GQL standardMATCH ... SEARCH ...syntax. This allows efficient pre-filtering directly within the vector index search (requires Neo4j 2026.01+).Metadata Configuration:
Added a
filterMetadatalist parameter to the builder. This is required when usingMATCH_SEARCH_CLAUSEto specify which metadata keys should be included in the vector index for native filtering.Test Refactoring & Coverage:
Neo4jEmbeddingStoreBaseTest.Neo4jEmbeddingStoreTestfor backward compatibility testing (runs against default Neo4j5.26).Neo4jEmbeddingStoreWith2026SyntaxTestwhich runs against theneo4j:2026.01-previewDocker image to verify the new syntax and filtering capabilities.Reference:
This implementation aligns with the features described in: Vector Search with Filters in Neo4j v2026.01.
General checklist
Checklist for adding new maven module
pom.xmlandlangchain4j-community-bom/pom.xmlChecklist for adding new embedding store integration
{NameOfIntegration}EmbeddingStoreITthat extends from eitherEmbeddingStoreITorEmbeddingStoreWithFilteringIT{NameOfIntegration}EmbeddingStoreRemovalITthat extends fromEmbeddingStoreWithRemovalITChecklist for changing existing embedding store integration
Neo4jEmbeddingStoreworks correctly with the data persisted using the latest released version of LangChain4j