uquery

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxRewriteMatches = 65536

MaxRewriteMatches is hard limit of documents joined by single nested / has_child / has_parent clause.

Variables

This section is empty.

Functions

func FormatResponse

func FormatResponse(resp *meta.SearchResponse, q *meta.ZedQuery, buckets *search.Bucket) error

func ParseQueryDSL

func ParseQueryDSL(q *meta.ZedQuery, mappings *meta.Mappings, analyzers map[string]*analysis.Analyzer) (riot.SearchRequest, error)

ParseQueryDSL parse query DSL and return searchRequest

func ParseQueryDSLFromV1

func ParseQueryDSLFromV1(q *v1.ZedQuery) (*meta.ZedQuery, error)

ParseQueryDSLFromV1 parse query DSL from search v1 and return new zed query DSL

func Rewrite

func Rewrite(query interface{}, exec func(sub map[string]interface{}, collectField string) ([]string, error)) (interface{}, error)

Rewrite replaces `nested`, `has_child`, `has_parent` and `parent_id` clauses of query DSL by plain term queries on hidden fields. Riot has no block join support, so joins are resolved in separate search pass (exec) and result is pushed back into query as list of document ids.

Clauses are rewritten as:

nested{path,query}       -> terms _id           of matching _nested_parent
has_child{type,query}    -> terms _id           of matching _join_parent
has_parent{type,query}   -> terms _join_parent  of matching _id
parent_id{type,id}       -> _join_name + _join_parent terms

`score_mode` / `score` are accepted but ignored: joined documents get constant score, child scores are not propagated to parent.

func RewriteLimit

func RewriteLimit() int

RewriteLimit returns maximum number of documents single join clause may match.

Types

type ExecFunc

type ExecFunc func(sub map[string]interface{}, collectField string) ([]string, error)

ExecFunc runs sub query and returns value of collectField for every matching document. Values are returned one per match, duplicates included, so that callers can count matches per parent (has_child min_children/max_children).

Directories

Path Synopsis
internal/testutil
Package testutil holds helpers shared by the analysis test packages.
Package testutil holds helpers shared by the analysis test packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL