{{ message }}
Repository navigation
fix(search): honor configured community search methods - #1968
Open
daleselaji-dev wants to merge 1 commit into
Open
daleselaji-dev wants to merge 1 commit into
daleselaji-dev wants to merge 1 commit into
Conversation
Contributor
Contributor
This branch has not been deployed
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.

Problem
CommunitySearchConfig.search_methodsis ignored bycommunity_search(). Every community search currently runs both full-text (BM25) and cosine-similarity retrieval, even when the caller explicitly selects only one method. This can add unnecessary work and can fail a request through a retrieval method that was intentionally excluded.Root Cause
community_search()unconditionally passed both retrieval coroutines tosemaphore_gather, instead of using the configuredCommunitySearchMethodvalues.Solution
Build the retrieval task list from
CommunitySearchConfig.search_methodsbefore gathering the selected methods.Changes
CommunitySearchMethod.bm25is configured.CommunitySearchMethod.cosine_similarityis configured.Testing
uv run pytest tests/utils/search -q— 33 passed.uv run pytest tests/utils/search -q— 35 passed.uv run ruff format --check graphiti_core/search/search.py tests/utils/search/test_community_search.py— passed.uv run ruff check graphiti_core/search/search.py tests/utils/search/test_community_search.py— passed.uv run pyright graphiti_core— 0 errors, 0 warnings.git diff --check— passed.Compatibility/Risk
This preserves the default recipe, which explicitly selects both community methods. Configurations selecting one method now execute only that method. No public API, result schema, reranking behavior, or database query is changed beyond avoiding unconfigured retrieval calls.
Notes for Reviewer
The patch is limited to
graphiti_core/search/search.pyand one unit test. The regression uses mocked retrieval functions and does not require a database or external service. AI assistance was used to prepare this contribution; the final diff and tests were reviewed locally.Linked Issue
Fixes #1967