Documentation
¶
Index ¶
- type BlockMatch
- type FilterCriteria
- type FollowResult
- type FollowTarget
- type QueryEngine
- func (qe *QueryEngine) Filter(nodes []domain.Node, criteria FilterCriteria) []domain.Node
- func (qe *QueryEngine) FilterBlocks(nodes []domain.Node, criteria FilterCriteria) []BlockMatch
- func (qe *QueryEngine) FollowBlocks(sourceMatches []BlockMatch, followField string, targets []FollowTarget, ...) ([]FollowResult, error)
- func (qe *QueryEngine) Search(nodes []domain.Node, term string) []domain.Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockMatch ¶
type BlockMatch struct {
NodeID string
NodeTitle string
SectionName string
BlockIndex int
Block domain.Block
}
BlockMatch represents a matched block with its parent context.
type FilterCriteria ¶
type FilterCriteria struct {
Kind *string // Filter by node kind (exact match)
Status *string // Filter by node status (exact match)
Tags []string // Filter by tags (node must have all specified tags)
BlockType *string // Filter by block type within content sections
FieldFilters map[string]string // Filter by block field key=value (AND logic)
}
FilterCriteria defines the criteria for filtering nodes and blocks.
type FollowResult ¶
type FollowResult struct {
Value string // The followed value (e.g., "Planks")
RefCount int // How many source blocks reference this value
Matches []BlockMatch // Blocks in target types that provide this value
}
FollowResult groups followed blocks by their source value.
type FollowTarget ¶
FollowTarget specifies a block type and field to follow into.
type QueryEngine ¶
type QueryEngine struct {
}
QueryEngine provides query and search capabilities for nodes.
func (*QueryEngine) Filter ¶
func (qe *QueryEngine) Filter(nodes []domain.Node, criteria FilterCriteria) []domain.Node
Filter returns nodes that match the given criteria. Multiple criteria are combined with AND logic. Empty criteria returns all nodes.
func (*QueryEngine) FilterBlocks ¶
func (qe *QueryEngine) FilterBlocks(nodes []domain.Node, criteria FilterCriteria) []BlockMatch
FilterBlocks returns blocks that match the given criteria, including block-level filters. Node-level filters (Kind, Status, Tags) narrow which nodes are searched. BlockType and FieldFilters filter blocks within matching nodes.
func (*QueryEngine) FollowBlocks ¶
func (qe *QueryEngine) FollowBlocks(sourceMatches []BlockMatch, followField string, targets []FollowTarget, allNodes []domain.Node, blockTypes map[string]config.BlockTypeConfig) ([]FollowResult, error)
FollowBlocks takes matched source blocks, extracts values from the follow field, and finds blocks in target types that provide those values. If targets is nil, it looks up the ref config for the source block type. Returns results grouped by followed value, sorted alphabetically.