Skip to main content
Basic search returns the most similar vectors to your query. Provide a query vector and the number of results to return. VectorAI DB uses your collection’s distance metric to rank results by similarity. This is the fastest search type because it performs only vector similarity computation without additional filtering or data retrieval. Use it when you need only semantic similarity without metadata filtering.
Each result includes these fields:
  • id: The unique identifier of the matching point.
  • score: Similarity score based on the collection’s distance metric.
  • payload: Metadata dictionary (only if with_payload=True).
  • vector: Vector embedding (only if with_vectors=True).

Search with payload filters

Filtered search combines vector similarity with metadata conditions. The filter evaluates alongside vector similarity, not instead of it. Use filtered search to combine semantic search with business rules like price ranges, availability status, or category restrictions.
Learn more about filter syntax and operators in the filtering documentation.
Each result includes these fields:
  • id: The unique identifier of the matching point.
  • score: Similarity score for points that passed the filter.
  • payload: Metadata dictionary showing filtered attributes.

Universal query API

The query() method provides a unified interface for all search operations, including vector search, payload-based ordering, and batch queries. This API simplifies complex queries and offers more flexibility than the basic search() method.

Basic query

Use query() for standard vector search:
Each result includes these fields:
  • id: The unique identifier of the matching point.
  • score: Similarity score based on the collection’s distance metric.
  • payload: Metadata dictionary containing point data.

Order by payload field

Sort results by payload fields without using vectors:
Each result includes these fields:
  • id: The unique identifier of the point.
  • payload: Metadata dictionary containing the point data.
  • score: Ordering score (may be null when using order_by without vector query).
Order-by queries support these scenarios:
  • Find highest or lowest prices.
  • Sort by date, newest or oldest.
  • Rank by rating or popularity.
  • Browse without semantic search.

Batch queries

Execute multiple queries in a single request:
Batch queries provide these advantages:
  • Single network round trip for multiple queries
  • Better throughput than individual requests
  • Reduced server overhead
  • Ideal for multiquery RAG applications
The method returns a list of result sets, one for each query. Each result set contains:
  • id: The unique identifier of the matching point.
  • score: Similarity score for the query.
  • payload: Metadata dictionary if requested.
  • vector: Vector embedding if requested.

Query with filters and ordering

Combine vector search with filters and custom ordering:
Each result includes these fields:
  • id: The unique identifier of the matching point.
  • score: Relevance score based on similarity or ordering criteria.
  • payload: Metadata dictionary containing the point data.
Use query() when:
  • Sorting by payload fields (order-by)
  • Running batch queries
  • You need the unified API for consistency
  • Building flexible query systems
Use search() when:
  • Pure vector similarity search
  • Simpler code is preferred
  • Using established search patterns
  • No need for order-by or batching

Interpret semantic search results

Each search result contains these components:

Required fields

  • id: Vector identifier as an integer.
  • score: Similarity measure as a float.

Optional fields

  • payload: Metadata dictionary when with_payload=True.
  • vector: Embedding array when with_vectors=True.