Skip to content

feat: add new falkordb integration#3158

Open
ghassenzaara wants to merge 23 commits intodeepset-ai:mainfrom
ghassenzaara:feature/falkordb-integration
Open

feat: add new falkordb integration#3158
ghassenzaara wants to merge 23 commits intodeepset-ai:mainfrom
ghassenzaara:feature/falkordb-integration

Conversation

@ghassenzaara
Copy link
Copy Markdown

@ghassenzaara ghassenzaara commented Apr 13, 2026

Related Issues

Proposed Changes:

  • Added FalkorDBDocumentStore to connect Haystack with FalkorDB graph databases.
  • Added FalkorDBEmbeddingRetriever for standard vector searches.
  • Added FalkorDBCypherRetriever for running custom GraphRAG Cypher queries.
  • Ensured document metadata is flattened and stored directly on the graph nodes.
  • Fixed vector insertion by casting arrays with vecf32() in Cypher queries.

How did you test it?

  • Unit tests: Added basic component and serialization tests (hatch run test:unit).
  • Integration tests: Verified writes, vector searches, and duplicate policies against a live database (hatch run test:integration).
  • Linters: Passed all type-checking and formatting checks (hatch run test:types, hatch run fmt).

Notes for the reviewer

  • Note the vecf32() explicit cast in the UNWIND cypher queries. This is specifically required by FalkorDB to parse vector embeddings correctly.

Checklist

@ghassenzaara ghassenzaara requested a review from a team as a code owner April 13, 2026 15:19
@ghassenzaara ghassenzaara requested review from davidsbatista and removed request for a team April 13, 2026 15:19
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added topic:CI type:documentation Improvements or additions to documentation labels Apr 13, 2026
@ghassenzaara ghassenzaara force-pushed the feature/falkordb-integration branch from c580421 to d380366 Compare April 14, 2026 09:18
@julian-risch julian-risch removed the request for review from davidsbatista April 15, 2026 13:29
Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

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

Thanks so much for this PR, @ghassenzaara! Great work so far. You'll see quite a few comments below, but they are mostly just minor formatting improvements for the docstrings.

- "Test / dspy"
- "Test / elasticsearch"
- "Test / faiss"
- "Test / falkor_db"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For consistency (for example with arcadedb) let's use falkordb throughout this integration instead of falkor_db, so changing for example also integrations/falkor_db -> integrations/falkordb.

Comment thread .github/labeler.yml Outdated
- any-glob-to-any-file: ".github/workflows/faiss.yml"


integration:falkor-db:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
integration:falkor-db:
integration:falkordb:

documented_only: true
skip_empty_modules: true
renderer:
description: FalkorDB integration for Haystack — GraphRAG document store, embedding retriever, and Cypher retriever
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: FalkorDB integration for Haystack — GraphRAG document store, embedding retriever, and Cypher retriever
description: FalkorDB integration for Haystack

Comment on lines +61 to +85
def to_dict(self) -> dict[str, Any]:
"""
Serialise this component to a dictionary.

:returns: Dictionary representation of this retriever's configuration.
"""
data = default_to_dict(
self,
custom_cypher_query=self._custom_cypher_query,
)
data["init_parameters"]["document_store"] = self._document_store.to_dict()
return data

@classmethod
def from_dict(cls, data: dict[str, Any]) -> "FalkorDBCypherRetriever":
"""
Deserialise this component from a dictionary.

:param data: Dictionary previously produced by :meth:`to_dict`.
:returns: A new :class:`FalkorDBCypherRetriever` instance.
"""
init_params = data.get("init_parameters", {})
if "document_store" in init_params:
init_params["document_store"] = FalkorDBDocumentStore.from_dict(init_params["document_store"])
return default_from_dict(cls, data)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These methods shouldn't be needed, see our documentation on default serialization behavior.

"""
Retrieve documents by executing an OpenCypher query.

If a ``query`` is provided here, it overrides the ``custom_cypher_query``
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We use single backticks inside docstrings for inline code.

Suggested change
If a ``query`` is provided here, it overrides the ``custom_cypher_query``
If a `query` is provided here, it overrides the `custom_cypher_query`

Comment on lines +600 to +612
Translate a Haystack filter dict into an OpenCypher ``WHERE`` sub-expression.

Supports the full Haystack filter DSL:

- Logical: ``AND``, ``OR``, ``NOT``
- Comparison: ``==``, ``!=``, ``>``, ``>=``, ``<``, ``<=``
- Membership: ``in``, ``not in``

All values are passed as named query parameters to prevent injection.

:param filters: A Haystack filter dictionary.
:returns: Tuple of ``(where_clause_string, params_dict)``.
:raises ValueError: If an unsupported operator or malformed filter is provided.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Translate a Haystack filter dict into an OpenCypher ``WHERE`` sub-expression.
Supports the full Haystack filter DSL:
- Logical: ``AND``, ``OR``, ``NOT``
- Comparison: ``==``, ``!=``, ``>``, ``>=``, ``<``, ``<=``
- Membership: ``in``, ``not in``
All values are passed as named query parameters to prevent injection.
:param filters: A Haystack filter dictionary.
:returns: Tuple of ``(where_clause_string, params_dict)``.
:raises ValueError: If an unsupported operator or malformed filter is provided.
Translate a Haystack filter dict into an OpenCypher `WHERE` sub-expression.
Supports the full Haystack filter DSL:
- Logical: `AND`, `OR`, `NOT`
- Comparison: `==`, `!=`, `>`, `>=`, `<`, `<=`
- Membership: `in`, `not in`
All values are passed as named query parameters to prevent injection.
:param filters: A Haystack filter dictionary.
:returns: Tuple of `(where_clause_string, params_dict)`.
:raises ValueError: If an unsupported operator or malformed filter is provided.

Comment thread integrations/falkor_db/pyproject.toml Outdated
build-backend = "hatchling.build"

[project]
name = "falkor-db-haystack"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
name = "falkor-db-haystack"
name = "falkordb-haystack"

Comment thread CLAUDE.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These changes should be reverted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's use our DocumentStoreBaseTests for testing the document store as described in our docs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's add a sentence here saying that in order to run the integration tests, a docker container needs to be run, similar to how we do for example for opensearch

@ghassenzaara
Copy link
Copy Markdown
Author

I re-requested a review by accident.
Thanks for the review; it's my first time contributing to open-source. I will pay attention to the documentation carefully and work on the requested changes.

@bogdankostic
Copy link
Copy Markdown
Contributor

I re-requested a review by accident. Thanks for the review; it's my first time contributing to open-source. I will pay attention to the documentation carefully and work on the requested changes.

No worries, let me know if there's anything you're unsure about.

… or falkor-db to falkordb for consistency, remove useless implementation, fix other small issues
@ghassenzaara
Copy link
Copy Markdown
Author

Hi @bogdankostic, I've addressed all the feedback from the previous review. The changes should now align with Haystack's integration conventions and requirements. Please let me know if anything else needs to be adjusted. Happy to iterate further!

@davidsbatista
Copy link
Copy Markdown
Contributor

I've created a follow up issue 3219 to add the extended operations to FalkorDBDocumentStore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants