search

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChunkResult

type ChunkResult struct {
	Chunk     store.Chunk
	Score     float32
	EntityIDs []string
}

ChunkResult is a search result from chunk/vector search.

type GlobalSearchResult

type GlobalSearchResult struct {
	Answer      string
	Communities []*store.Community
}

GlobalSearchResult aggregates community summaries.

func GlobalSearch

func GlobalSearch(ctx context.Context, st *store.Store, emb *embedder.Embedder, prov llm.Provider, query string, communityLevel int) (*GlobalSearchResult, error)

GlobalSearch performs community summary aggregation (GraphRAG global search).

type LocalSearchResult

type LocalSearchResult struct {
	Chunks   []ChunkResult
	Entities []*store.Entity
	Rels     []*store.Relationship
}

LocalSearchResult combines vector + graph results.

func LocalSearch

func LocalSearch(ctx context.Context, st *store.Store, emb *embedder.Embedder, idx vectorindex.Index, query string, topK, graphDepth int) (*LocalSearchResult, error)

LocalSearch performs vector similarity search + graph walk.

If idx is non-nil and non-empty, the top-K chunk retrieval uses the HNSW index (O(log n)); otherwise LocalSearch falls back to the historical O(n) brute-force scan. This lets tests keep working without wiring an index, while production serve.go always passes one.

Jump to

Keyboard shortcuts

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