Skip to content

aegean.search

Unified diacritic-insensitive full-text search with lazy SQLite FTS5 sidecar indexes across registered corpora, the Greek New Testament (all 9 editions), the 55-book Swete Septuagint, the 33-volume Patrologia Graeca, Perseus / First1KGreek works, and local .json/.json.gz/.db files.

search

Unified full-text search with lazy SQLite FTS5 sidecar indexes.

Provides one fast, diacritic-insensitive search surface across every text source in pyaegean:

  • Registered corpora (bundled or hosted): lineara, damos, isicily, aphrodisias, crete, apostolic-fathers, pseudepigrapha, byzantine, homer-scholia, nt, ddbdp, patrologia, ...
  • Biblical & Patristic bundles: lxx (all 56 Septuagint books), nt / nt-editions (any of the 9 Greek NT editions), PG073 (or any Patrologia Graeca volume), or tlg0012.tlg001 (Perseus / First1KGreek work).
  • Local files: .json, .json.gz, or .db/.sqlite corpora.

For large on-disk JSON/JSON.gz corpora (such as the 6.79M-word Patrologia Graeca archive, 55-book Swete LXX, 9-edition NT bundle, or epigraphic corpora), a local SQLite FTS5 sidecar database is built once under PYAEGEAN_CACHE/fts/ and invalidated automatically if the source file's mtime or size changes. Warm queries typically complete in under 50 ms without deserializing JSON.

Zero non-stdlib dependencies; lazily exported as aegean.search.

SearchHit dataclass

SearchHit(source: str, doc_id: str, ref: str, snippet: str, text: str, score: float = 0.0, meta: dict[str, Any] = dict())

One ranked full-text match across any pyaegean corpus or text archive.

fold_greek

fold_greek(text: str) -> str

Lowercase and strip Greek/Unicode combining marks; fold final sigma ς -> σ.

fts_index_path

fts_index_path(source_path: Path | str, *, tag: str = '') -> Path

Return the sidecar SQLite FTS5 path for an on-disk corpus file.

clear_fts_cache

clear_fts_cache() -> int

Delete all cached SQLite FTS5 sidecar files; return bytes reclaimed.

search_corpus

search_corpus(corpus: 'Corpus', query: str, *, source: str = '', limit: int = 25, exact: bool = False) -> list[SearchHit]

Search an already-loaded in-memory :class:~aegean.core.corpus.Corpus.

search_text

search_text(query: str, target: str = 'nt', *, limit: int = 25, exact: bool = False, book: str | None = None, edition: str | None = None, offline: bool = False) -> list[SearchHit]

Search any corpus, Bible edition, Septuagint, Patrologia Graeca, work, or local file.

Uses lazy SQLite FTS5 sidecar indexes for on-disk JSON/JSON.gz corpora so repeated searches over multi-million-word archives return in milliseconds.