Vespa Query Language (YQL) is a SQL-like language used to express search queries in Vespa. YQL provides a powerful and flexible way to query your data with support for boolean operators, filters, and advanced search features.Documentation Index
Fetch the complete documentation index at: https://support.agentrank.io/llms.txt
Use this file to discover all available pages before exploring further.
Basic Syntax
YQL queries follow this basic structure:Simple Query Example
title field contains the term “vespa”.
Query Operators
Text Matching
YQL supports multiple text matching operators:Boolean Operators
Combine multiple conditions using boolean operators:Numeric and Range Queries
Field Selection
Control which fields are returned in the results:Ordering and Pagination
Order By
Sort results by one or more fields:Limit and Offset
Paginate results:Advanced Queries
WeakAnd for Large Result Sets
UseweakAnd for efficient queries that match many documents:
container-search/src/main/java/com/yahoo/search/Query.java:44-46):
- YQL queries are parsed by
YqlParser - Serialized using
VespaSerializer - Support structured boolean trees and natural language text
Annotations
Add query annotations for fine-grained control:Available annotations include:
stem: Control stemming (true/false)ranked: Include term in ranking (true/false)prefix: Enable prefix matchingweight: Set term weight
Embedded Queries
User Query
Delegate query parsing to Vespa’s query parser:Combining with YQL
Timeout
Set query timeout in milliseconds:Sources
Specify which schemas/document types to query:Grouping Integration
YQL queries can include grouping operations (see Grouping & Aggregation for details):Best Practices
YQL Parser Implementation
Vespa’s YQL implementation (container-search/src/main/java/com/yahoo/search/yql/YqlParser.java) supports:
- Multiple query item types:
WordItem,PhraseItem,AndItem,OrItem,NotItem - Numeric operators:
IntItem,RangeItem,NumericInItem - Advanced items:
NearestNeighborItem,FuzzyItem,RegExpItem,WeakAndItem,WandItem - Geo-location queries:
GeoLocationItem - Predicate queries:
PredicateQueryItem
Next Steps
- Learn about Vector Search with YQL
- Explore Text Search capabilities
- Understand Ranking Expressions to control result ordering