yase

module
v0.0.0-...-235531b Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0

README

YASE — Yet Another Search Engine

A production-grade, distributed hybrid search engine in Go, purpose-built for retrieval-augmented generation (RAG) and agent-native search. YASE fuses lexical and semantic retrieval — BM25 full-text search (Bluge) and HNSW vector similarity — into a single pipeline using Reciprocal Rank Fusion and an optional cross-encoder reranker, then serves results as citable, attributed evidence for LLMs.

Key Features

  • Hybrid search — BM25 + HNSW-IF vector search, fused via Reciprocal Rank Fusion with an optional cross-encoder reranker.
  • Pre-filtering, not post-filtering — metadata and tenant filters run before vector math via Bluge Roaring Bitmaps, so restricted users never see documents they can't access (a common failure mode of pure vector databases).
  • Agentic RAG API/v1/rag returns inline [N] citations, source URLs, chunk text, and per-result scores, ready to inject straight into an LLM prompt.
  • Semantic + AST-aware chunking — cosine-similarity valley detection groups prose by topic; tree-sitter keeps code units (functions, classes) intact.
  • Local, self-hosted embeddings — TEI with GTE-ModernBERT-base (768-dim, MTEB 64.38) keeps data in-house at zero per-token cost. Ollama and OpenAI providers included.
  • Collections — physically isolated search spaces with per-collection embedders and config, plus cross-collection fan-out merged via RRF.
  • 10 enterprise connectors — Confluence, Jira, S3, PostgreSQL, MySQL, Google Drive, Salesforce, SharePoint, Slack, Twitter/X, plus a go-plugin system for custom sources.
  • Distributed scale-out — Raft consensus, consistent hashing, and scatter-gather across shards.
  • Production-ready — API-key/JWT auth, TLS, tenant isolation, rate limiting, audit logging, JSON logging, OpenTelemetry tracing, Prometheus metrics, and a Helm chart.

Why YASE for Agentic RAG

Retrieval for LLM agents differs from classic search: agents need correctly-scoped, citable evidence with full provenance — not just a ranked list of links. YASE is built around that contract.

Agent requirement How YASE delivers it
Grounded answers /v1/rag returns citations with doc_id, source_url, chunk_text, and [N] markers to pin claims to evidence
Correct access control _tenant filters are injected server-side and cannot be overridden, scoping every query to the caller's data
Coherent context windows Semantic valley + AST-aware chunking keep topics and functions whole — no mid-thought splits
Keyword + semantic precision 5-stage pipeline: BM25 pre-filter → HNSW traversal → cosine rescore → RRF → cross-encoder rerank
Whole-corpus recall Cross-collection fan-out searches every collection and merges with RRF — no global "superset" duplication
Data sovereignty Self-hosted TEI embeddings — no documents or queries leave your infrastructure
Fresh indexes Deterministic chunk IDs + delete-before-write mean updated sources never leave stale chunks
Full provenance Every result carries its metadata (URL, author, timestamps) for transparent attribution

One call, ready for your LLM:

curl -s -X POST http://localhost:8000/v1/rag \
  -H "Content-Type: application/json" \
  -d '{"query": "How does HNSW work?", "top_k": 5, "include_text": true}' | jq
{
  "status": "success",
  "query": "How does HNSW work?",
  "citations": [
    {
      "doc_id": 12345,
      "chunk_text": "HNSW builds a multi-layer graph where top layers provide long-range shortcuts...",
      "source_url": "https://example.com/hnsw.md",
      "relevance_score": 0.0421,
      "bm25_score": 8.2,
      "semantic_score": 0.87,
      "metadata": { "source": "confluence", "space": "ENG" }
    }
  ],
  "context": "[1] HNSW builds a multi-layer graph where...\n\n[2] Reciprocal Rank Fusion merges...",
  "duration_ms": 42
}

The assembled context string with [1], [2], … markers can be injected directly into a system or user prompt for grounded generation.

Architecture

┌─────────────────┐    ┌──────────────────┐    ┌──────────────────────┐
│   Connectors    │    │     Crawler      │    │   Direct Ingest      │
│ Confluence/Jira │    │  Master/Worker   │    │   gRPC :50051        │
│ S3/Postgres/... │    │                  │    │                      │
└────────┬────────┘    └────────┬─────────┘    └──────────┬───────────┘
         │ _collection_id       │                          │
         └──────────────┬───────┘──────────────────────────┘
                        │ Kafka (crawl-records)
                        ▼
              ┌─────────────────────┐
              │      Indexer        │     ┌───────────────┐
              │  Collection Manager │────►│  TEI Embedder │
              │  routes by          │     │  :8888        │
              │  _collection_id     │     └───────────────┘
              │  ┌───────┐┌───────┐│
              │  │_default││col-A ││  ← each collection has own
              │  │ Engine ││Engine ││    Bluge + HNSW-IF + Arena
              │  └───────┘└───────┘│
              └─────────┬───────────┘
                        │ gRPC
              ┌─────────▼───────────┐     ┌───────────────┐
              │      Gateway        │────►│ TEI Reranker  │
              │  :8000 (HTTP)       │     │  :8081        │
              │  /search            │     └───────────────┘
              │  /v1/collections/*  │
              └─────────────────────┘

Quick Start

# 1. Start infrastructure
docker compose -f deploy/docker-compose.yml up -d redis kafka

# 2. Start TEI embedder (builds from source on first run for Apple Silicon)
~/bin/text-embeddings-router --model-id Alibaba-NLP/gte-modernbert-base --port 8888 &

# 3. Start the combined indexer + gateway
YASE_EMBEDDER_PROVIDER=tei go run cmd/local/main.go &

# 4. Start ingestion
go run cmd/ingestion/main.go &

# 5. Search
curl -s -X POST http://localhost:8000/search \
  -H "Content-Type: application/json" \
  -d '{"query": "Go programming language", "top_k": 5}' | jq

See Getting Started for the full walkthrough (RAG, autocomplete, delete, crawler, connectors).

Documentation

Doc Description
Getting Started Full local setup, RAG, autocomplete, delete, crawler, connectors
Architecture Services, search pipeline, project structure
Collections Data isolation, cross-collection search, management
Connectors & Embeddings Enterprise data sources and embedding providers
Configuration & Security Config reference, auth, TLS, tenant isolation, observability
API Reference Endpoints + Go client SDK
Deployment & Operations Docker Compose, Helm, build & test
End-to-End Testing Local 3-node distributed E2E: infra setup, colima, TEI, defects found

License

Apache 2.0

Directories

Path Synopsis
Package client provides a Go SDK for the YASE search API.
Package client provides a Go SDK for the YASE search API.
cmd
cluster-node command
cluster-node runs a distributed YASE node that:
cluster-node runs a distributed YASE node that:
connector command
cmd/connector runs the YASE Connector Manager service.
cmd/connector runs the YASE Connector Manager service.
crawler command
dist-gateway command
dist-gateway runs the distributed search gateway.
dist-gateway runs the distributed search gateway.
gateway command
indexer command
ingest-demo command
cmd/ingest-demo sends sample documents to the ingestion server via gRPC.
cmd/ingest-demo sends sample documents to the ingestion server via gRPC.
ingestion command
local command
cmd/local combines the indexer (Kafka consumer) and gateway (HTTP search API) into a single process so they can share the same Bluge writer lock.
cmd/local combines the indexer (Kafka consumer) and gateway (HTTP search API) into a single process so they can share the same Bluge writer lock.
yase-ctl command
yase-ctl is the CLI for managing a YASE distributed cluster.
yase-ctl is the CLI for managing a YASE distributed cluster.
internal
broker
Package broker provides Kafka producers, consumers, and topic management for the ingestion pipeline.
Package broker provides Kafka producers, consumers, and topic management for the ingestion pipeline.
connector/confluence
Package confluence implements a YASE connector for Atlassian Confluence.
Package confluence implements a YASE connector for Atlassian Confluence.
connector/gdrive
Package gdrive implements a YASE connector for Google Drive / Google Docs.
Package gdrive implements a YASE connector for Google Drive / Google Docs.
connector/jira
Package jira implements a YASE connector for Atlassian Jira.
Package jira implements a YASE connector for Atlassian Jira.
connector/mysql
Package mysql implements a YASE connector for MySQL/MariaDB databases.
Package mysql implements a YASE connector for MySQL/MariaDB databases.
connector/postgres
Package postgres implements a YASE connector for PostgreSQL using timestamp-based incremental sync.
Package postgres implements a YASE connector for PostgreSQL using timestamp-based incremental sync.
connector/s3store
Package s3store implements a YASE connector for S3-compatible object storage.
Package s3store implements a YASE connector for S3-compatible object storage.
connector/salesforce
Package salesforce implements a YASE connector for Salesforce CRM.
Package salesforce implements a YASE connector for Salesforce CRM.
connector/sharepoint
Package sharepoint implements a YASE connector for SharePoint Online via the Microsoft Graph API.
Package sharepoint implements a YASE connector for SharePoint Online via the Microsoft Graph API.
connector/slack
Package slack implements a YASE connector for Slack workspaces.
Package slack implements a YASE connector for Slack workspaces.
connector/twitter
Package twitter implements a YASE connector for Twitter/X. Uses the X API v2 with OAuth2 Bearer token authentication.
Package twitter implements a YASE connector for Twitter/X. Uses the X API v2 with OAuth2 Bearer token authentication.
indexsvc
Package indexsvc implements the gRPC IndexService that owns the hybrid engine.
Package indexsvc implements the gRPC IndexService that owns the hybrid engine.
pkg
audit
Package audit provides structured audit event logging for compliance.
Package audit provides structured audit event logging for compliance.
auth
Package auth provides authentication and authorization for YASE APIs.
Package auth provides authentication and authorization for YASE APIs.
cache
Package cache provides LRU caching for search results to avoid redundant embedding + search pipeline execution for repeated queries.
Package cache provides LRU caching for search results to avoid redundant embedding + search pipeline execution for repeated queries.
connector
Package connector defines the core interfaces and types for YASE's enterprise connector system.
Package connector defines the core interfaces and types for YASE's enterprise connector system.
logging
Package logging provides structured logging for YASE services.
Package logging provides structured logging for YASE services.
metrics
Package metrics defines the Prometheus metrics exposed by YASE services.
Package metrics defines the Prometheus metrics exposed by YASE services.
storage
Package storage provides object storage backends (S3, filesystem, cached) used by the offline index builder and connectors.
Package storage provides object storage backends (S3, filesystem, cached) used by the offline index builder and connectors.
tracing
Package tracing provides OpenTelemetry distributed tracing for YASE.
Package tracing provides OpenTelemetry distributed tracing for YASE.
proto
v1
test
relevance
Package relevance provides search quality evaluation metrics.
Package relevance provides search quality evaluation metrics.

Jump to

Keyboard shortcuts

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