Skip to content

fix(pinecone): pass namespace to similarity_search - #13854

Open
gingeekrishna wants to merge 1 commit into
langflow-ai:mainfrom
gingeekrishna:fix/9188-pinecone-namespace-similarity-search
Open

fix(pinecone): pass namespace to similarity_search#13854
gingeekrishna wants to merge 1 commit into
langflow-ai:mainfrom
gingeekrishna:fix/9188-pinecone-namespace-similarity-search

Conversation

@gingeekrishna

@gingeekrishna gingeekrishna commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • search_documents() was calling similarity_search() without forwarding the namespace parameter
  • Searches always hit the default namespace regardless of what the user configured in the component
  • One-line fix: add namespace=self.namespace to the similarity_search() call

Fixes #9188

Test plan

  • Added test_pinecone_vector_store_component.py with two regression tests:
    • Verifies similarity_search is called with namespace=self.namespace for a named namespace
    • Verifies an empty namespace string is still forwarded (not silently dropped)

Summary by CodeRabbit

  • Bug Fixes
    • Search results now respect the configured namespace, so vector searches are correctly scoped when a namespace is set.
    • Empty namespace values are also passed through as expected.
  • Tests
    • Added regression coverage to verify namespace handling during document search and confirm the search parameters are forwarded correctly.

Copilot AI review requested due to automatic review settings June 26, 2026 08:11

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 18da6d24-401f-4fc8-9eee-13c67c47d850

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

PineconeVectorStoreComponent.search_documents() now passes its namespace to similarity_search(). A new regression test module checks forwarded namespaces for both populated and empty-string values.

Changes

Pinecone namespace forwarding

Layer / File(s) Summary
Search namespace forwarding
src/lfx/src/lfx/components/pinecone/pinecone.py
search_documents() now calls similarity_search() with namespace=self.namespace.
Regression tests
src/lfx/tests/unit/components/test_pinecone_vector_store_component.py
Adds a mocked vector-store test module that asserts similarity_search() receives the configured namespace, including the empty-string case, with dependency skip guards.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #10512: Describes the Pinecone search path missing namespace forwarding on similarity search, which this change addresses.
🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main Pinecone fix in this PR.
Linked Issues check ✅ Passed The change matches issue #9188 by passing the configured namespace into Pinecone similarity_search.
Out of Scope Changes check ✅ Passed The code and tests stay within the scope of the Pinecone namespace search fix.
Test Coverage For New Implementations ✅ Passed A new test_pinecone_vector_store_component.py regression suite was added, named per convention, and it asserts namespace forwarding in similarity_search().
Test Quality And Coverage ✅ Passed The new pytest unit tests directly assert similarity_search receives namespace (including empty string) via Mock/patch, so they validate the fix and follow repo test patterns.
Test File Naming And Structure ✅ Passed New backend unit test follows test_*.py pytest conventions, uses descriptive names, and covers both namespace and empty-string cases.
Excessive Mock Usage Warning ✅ Passed Mocks are narrowly scoped: one MagicMock vector store plus patch.object on build_vector_store to isolate Pinecone; core logic stays exercised.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 26, 2026
@gingeekrishna
gingeekrishna force-pushed the fix/9188-pinecone-namespace-similarity-search branch from d257848 to e3fdf16 Compare June 26, 2026 08:19
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 26, 2026

@jashwanth-reddy-g jashwanth-reddy-g left a comment

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.

This looks great. Passing the namespace to similarity_search fixes the bug where searches would incorrectly default to the empty namespace regardless of component configuration. The accompanying regression test is clear and ensures this won't regress. LGTM!

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jul 5, 2026
search_documents() was calling similarity_search() without forwarding
the namespace parameter, so searches always hit the default namespace
regardless of the value configured by the user.

Fixes langflow-ai#9188

Signed-off-by: Radhakrishnan Pachyappan <gingeekrishna@gmail.com>
@gingeekrishna
gingeekrishna force-pushed the fix/9188-pinecone-namespace-similarity-search branch from 2fcf971 to 596181d Compare August 16, 2026 16:48
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pinecone vector store does not use namespace on similarity search

3 participants