RyanCodrai/turbovec · error · NotImplementedError

filter operator {op!r} not supported by TurboQuantVectorStor

Error message

filter operator {op!r} not supported by TurboQuantVectorStore

What it means

NotImplementedError raised in _single_filter_match when the filter operator is one TurboQuantVectorStore does not implement — any FilterOperator beyond the supported set (CONTAINS, TEXT_MATCH, TEXT_MATCH_INSENSITIVE, ALL, ANY, and the comparison/equality operators handled earlier). It fails loudly rather than silently mis-evaluating an unsupported operator.

Source

Thrown at turbovec-python/python/turbovec/llama_index.py:782

            raise TypeError(
                "Both metadata value and filter value must be strings "
                "for the TEXT_MATCH operator"
            )
        if _TEXT_MATCH_INSENSITIVE is not None and op == _TEXT_MATCH_INSENSITIVE:
            if isinstance(target, str) and isinstance(value, str):
                return target.lower() in value.lower()
            raise TypeError(
                "Both metadata value and filter value must be strings "
                "for the TEXT_MATCH_INSENSITIVE operator"
            )
        if op == FilterOperator.ALL:
            # Reference (`utils.py:152-153`): every element of `target`
            # must be present in the metadata value (which is typically
            # a list — tag-set matching).
            return all(t in value for t in target)
        if op == FilterOperator.ANY:
            return any(t in value for t in target)
        raise NotImplementedError(
            f"filter operator {op!r} not supported by TurboQuantVectorStore"
        )

    def query(self, query: VectorStoreQuery, **_: Any) -> VectorStoreQueryResult:
        # MMR / SVM / LINEAR_REGRESSION / HYBRID etc. all need access to
        # full-precision vectors (for pairwise diversity, learned scoring,
        # or sparse-dense fusion). turbovec discards full precision after
        # quantization, so any non-DEFAULT mode is unsupportable here.
        # Raise loudly instead of silently treating it as DEFAULT, which
        # the previous impl did and which let callers think they were
        # getting e.g. MMR diversity when they were not.
        if query.mode != VectorStoreQueryMode.DEFAULT:
            raise NotImplementedError(
                f"TurboQuantVectorStore does not support query mode "
                f"{query.mode!r}. Only VectorStoreQueryMode.DEFAULT is "
                "supported — MMR / SVM / hybrid modes need access to "
                "full-precision vectors which turbovec discards after "
                "quantization. Maintain a parallel store with full vectors "

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Rewrite the filter using a supported operator (e.g. EQ, IN, TEXT_MATCH)
  2. Emulate unsupported operators with custom filtering after fetching nodes
  3. Check the installed llama_index-core's FilterOperator enum and this store's docs

Example fix

// before
MetadataFilter(key="tags", value="a", operator=FilterOperator.CONTAINS)
// after
MetadataFilter(key="tags", value="a", operator=FilterOperator.IN)
Defensive patterns

Strategy: fallback

Validate before calling

SUPPORTED = {FilterOperator.EQ, FilterOperator.NE, FilterOperator.GT, FilterOperator.GTE, FilterOperator.LT, FilterOperator.LTE, FilterOperator.IN, FilterOperator.ANY, FilterOperator.ALL, FilterOperator.TEXT_MATCH, FilterOperator.TEXT_MATCH_INSENSITIVE}
assert all(f.operator in SUPPORTED for f in filters.filters), "unsupported filter operator"

Try / catch

try:
    store.query(q)
except NotImplementedError as e:
    if "filter operator" in str(e):
        raise RuntimeError("rewrite this filter with a supported operator") from e
    raise

Prevention

When it happens

Trigger: Passing a MetadataFilter with an operator outside the supported set (e.g. FilterOperator.CONTAINS or IS_EMPTY depending on version) via query/delete_nodes/get_nodes filters.

Common situations: Version drift between llama_index-core releases adding/removing operators; copy-pasted filter code using an operator this store never implemented.

Related errors


AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06). Data as JSON: /api/errors/ad21847696e9e0d5. Report an issue: GitHub.