Operation to search for items within a namespace prefix.

interface SearchOperation {
    filter?: Record<string, any>;
    limit?: number;
    namespacePrefix: string[];
    offset?: number;
    query?: string;
}

Properties

filter?: Record<string, any>

Key-value pairs to filter results based on exact matches or comparison operators.

Supports both exact matches and operator-based comparisons:

  • $eq: Equal to (same as direct value comparison)
  • $ne: Not equal to
  • $gt: Greater than
  • $gte: Greater than or equal to
  • $lt: Less than
  • $lte: Less than or equal to

Example

// Exact match
filter: { status: "active" }

// With operators
filter: { score: { $gt: 4.99 } }

// Multiple conditions
filter: {
score: { $gte: 3.0 },
color: "red"
}
limit?: number

Maximum number of items to return.

Default

10
namespacePrefix: string[]

Hierarchical path prefix to search within. Only items under this prefix will be searched.

Example

// Search all user documents
namespacePrefix: ["users", "documents"]

// Search everything
namespacePrefix: []
offset?: number

Number of items to skip before returning results. Useful for pagination.

Default

0
query?: string

Natural language search query for semantic search. When provided, results will be ranked by relevance to this query using vector similarity search.

Example

// Find technical documentation about APIs
query: "technical documentation about REST APIs"

// Find recent ML papers
query: "machine learning papers from 2023"