Skip to content

SqliteStore ignores the documented fields index configuration #8808

Description

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Related Issues / PRs

#4343 and #4345 fixed the same fields/text_fields mismatch for PostgresStore. The SQLite implementation appears to still use text_fields.

Reproduction Steps / Example Code (Python)

from langchain_core.embeddings import Embeddings
from langgraph.store.sqlite import SqliteStore


class RecordingEmbeddings(Embeddings):
    def __init__(self):
        self.calls = []

    def embed_documents(self, texts):
        self.calls.append(list(texts))
        return [[1.0, 0.0] for _ in texts]

    def embed_query(self, text):
        return [1.0, 0.0]


embeddings = RecordingEmbeddings()
with SqliteStore.from_conn_string(
    ":memory:",
    index={"dims": 2, "embed": embeddings, "fields": ["text"]},
) as store:
    store.setup()
    store.put(
        ("docs",),
        "doc",
        {"text": "indexed", "metadata": "not indexed"},
    )
    print("embed_inputs:", embeddings.calls)
    print(
        "vector_fields:",
        [
            row[0]
            for row in store.conn.execute(
                "SELECT field_name FROM store_vectors"
            )
        ],
    )

Error Message and Stack Trace (if applicable)

Actual output:

embed_inputs: [['{"metadata": "not indexed", "text": "indexed"}']]
vector_fields: ['$']

Expected output:

embed_inputs: [['indexed']]
vector_fields: ['text']

Description

When fields is set in the index configuration for SqliteStore, it is ignored and the configuration falls back to ['$']. As a result, the entire item is embedded instead of only the configured fields. This can affect search results and send additional item data to an external embedding provider.

The SQLite index configuration normalizer reads text_fields instead of the documented fields key. Using the undocumented text_fields key produces the expected result.

System Info

System Information

OS: Linux
OS Version: 22.04.1-Ubuntu
Python Version: 3.14.7

Package Information

langchain_core: 1.5.2
langsmith: 0.8.18
langchain_protocol: 0.0.18

Activity

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

    bugSomething isn't workingexternal

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions