Skip to content

bug(retrieval): CouchbaseVectorStore.search returns empty text/metadata (missing SearchOptions fields) #1013

Closed

Description

@AmitoVrito

Found during review of #1012 (issue #888 vector stores).

Problem

CouchbaseVectorStore._search_sync called scope.search(index, request) without SearchOptions(fields=[...]). The Couchbase FTS Python SDK returns only id + score per SearchRow unless fields are explicitly requested; SearchRow.fields is otherwise empty. So against a real Couchbase cluster every hit came back with text="" and metadata={} — retrieval was effectively broken.

Secondary: the row-field extraction assumed row.fields might be callable, but in couchbase 4.x SearchRow.fields is a dict attribute, so the code path .get() on the SearchRow itself would raise AttributeError.

The smoke-test fake returned populated fields and ignored search options, hiding both issues (the classic "plausible-but-wrong API" trap).

Fix

  • Pass SearchOptions(fields=["*"], limit=limit) to scope.search(...).
  • Extract row.fields handling both the dict attribute (real SDK) and a callable (defensive).
  • Regression test reshaped to model SearchRow.fields as a dict attribute and to assert fields=["*"] is requested (fails on old code, passes on fix).

Fixed as part of merging #1012.

Activity

  1. added
    bug
    on Sep 3, 2026
  2. added a commit that references this issue on Sep 3, 2026
    f914dd9
  3. added a commit that references this issue on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions