Skip to content

Improve vectorstore query validation and error context #9

Description

@deepintai

Context

The vectorstore abstraction supports several query operators (Equal, GreaterThan, Like, ContainsAny, etc.) across backends (Redis, Weaviate, Qdrant, Pinecone). When a query uses an operator a backend does not support, the failure surfaces as the generic ErrNotSupported with no indication of which field or operator caused it — hard to diagnose.

What to do

  1. Add a pre-flight validator in store.go:
    func ValidateQuery(query Query, supportedOperators []QueryOperator) error
    that rejects operators not in the supported set and surfaces type mismatches.
  2. Extend errors.go with ErrInvalidOperator and ErrInvalidQueryValue sentinel errors.
  3. Add a helper SupportedOperatorsForBackend(backendType VectorStoreType) []QueryOperator.
  4. In at least one backend (e.g. redis.go), wrap query failures with field name and operator, e.g. "query failed on field 'age' with operator 'Like': operation not supported".

Acceptance criteria

  • ValidateQuery can be called before execution and returns errors that name the offending field and operator.
  • New sentinel errors added and used.
  • At least one backend produces enhanced, field/operator-aware error messages.
  • Errors distinguish "unsupported operator" from a genuine backend query failure.
  • New unit tests assert the error messages; go test ./framework/vectorstore/... passes.

File pointers

  • Store interface + operators: deepintshield_server/framework/vectorstore/store.go (interface ~80-107, operators ~28-42)
  • Errors: deepintshield_server/framework/vectorstore/errors.go
  • Example backend: deepintshield_server/framework/vectorstore/redis.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions