pathwaycom/pathway · error · NotImplementedError

Currently, usearch knn index is supported only in the as-of-

Error message

Currently, usearch knn index is supported only in the as-of-now variant

What it means

The USearch-backed KNN index in pathway.stdlib.indexing.nearest_neighbors only implements query_as_of_now: queries are answered against the index as of the current minibatch, without waiting for pending insertions to settle. Its query() method exists to satisfy the index interface but unconditionally raises NotImplementedError with this message.

Source

Thrown at python/pathway/stdlib/indexing/nearest_neighbors.py:119

    expansion_search: int = 0
    embedder: pw.UDF | None = None

    # data column after applying embeddings. It is calculated during initialization and
    # cannot be set in the constructor.
    _data_column: pw.ColumnReference = field(init=False)

    def __post_init__(self):
        _data_column = _calculate_embeddings(self.data_column, self.embedder)
        object.__setattr__(self, "_data_column", _data_column)

    def query(
        self,
        query_column: pw.ColumnReference,
        number_of_matches: pw.ColumnExpression | int = 3,
        metadata_filter: pw.ColumnExpression | None = None,
    ) -> pw.Table:
        """Currently, usearch knn index is supported only in the as-of-now variant"""
        raise NotImplementedError(
            "Currently, usearch knn index is supported only in the as-of-now variant"
        )

    @check_arg_types
    def query_as_of_now(
        self,
        query_column: pw.ColumnReference,
        number_of_matches: pw.ColumnExpression | int = 3,
        metadata_filter: pw.ColumnExpression | None = None,
    ) -> pw.Table:
        index = self._data_column.table

        query_column = _calculate_embeddings(query_column, self.embedder)
        queries = query_column.table

        check_default_knn_column_types(
            self._data_column,
            query_column,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Switch the call to query_as_of_now(query_column, number_of_matches=...).
  2. In polymorphic code, prefer query_as_of_now uniformly across indices.
  3. If strict consistency of query() matters for your use case, track the Pathway changelog for USearch query() support.

Example fix

# before
results = index.query(query_table.query, number_of_matches=3)

# after
results = index.query_as_of_now(query_table.query, number_of_matches=3)
Defensive patterns

Strategy: try-catch

Try / catch

try:
    res = index.query(query_col, number_of_matches=3)
except NotImplementedError:
    res = index.query_as_of_now(query_col, number_of_matches=3)

Prevention

When it happens

Trigger: Calling .query(query_column, number_of_matches=..., metadata_filter=...) on a UsearchKNNIndex instance (built directly or via UsearchKnnFactory.build_inner_index / .build_index) instead of .query_as_of_now().

Common situations: Generic retrieval code that calls .query() on any index polymorphically; older Pathway examples that predate the as-of-now split; LLM app templates wired to the default query path.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/998e7520559bf912. Report an issue: GitHub.