hermes_core/
lib.rs

1//! Hermes - A minimal async search engine library
2//!
3//! Inspired by tantivy/summavy, this library provides:
4//! - Fully async IO with Directory abstraction for network/local/memory storage
5//! - SSTable-based term dictionary with hot cache and lazy loading
6//! - Bitpacked posting lists with block-level skip info
7//! - Document store with Zstd compression
8//! - Multiple segments with merge support
9//! - Text and numeric field support
10//! - Term, boolean, and boost queries
11//! - BlockWAND / MaxScore query optimizations
12
13pub mod compression;
14pub mod directories;
15pub mod dsl;
16pub mod error;
17pub mod index;
18pub mod query;
19pub mod segment;
20pub mod structures;
21pub mod tokenizer;
22pub mod wand;
23
24// Re-exports from dsl
25pub use dsl::{
26    Document, Field, FieldDef, FieldEntry, FieldType, FieldValue, IndexDef, QueryLanguageParser,
27    Schema, SchemaBuilder, SdlParser, parse_sdl, parse_single_index,
28};
29
30// Backwards compatibility alias
31pub mod schema {
32    pub use crate::dsl::{
33        Document, Field, FieldEntry, FieldType, FieldValue, Schema, SchemaBuilder,
34    };
35}
36
37// Re-exports from structures
38pub use structures::{
39    AsyncSSTableReader, BlockPostingList, HorizontalBP128Iterator, HorizontalBP128PostingList,
40    PostingList, PostingListIterator, SSTableValue, TERMINATED, TermInfo,
41};
42
43// Re-exports from directories
44#[cfg(feature = "native")]
45pub use directories::FsDirectory;
46#[cfg(feature = "http")]
47pub use directories::HttpDirectory;
48pub use directories::{
49    AsyncFileRead, CachingDirectory, Directory, DirectoryWriter, FileSlice, LazyFileHandle,
50    LazyFileSlice, OwnedBytes, RamDirectory, SliceCacheStats, SliceCachingDirectory,
51};
52
53// Re-exports from segment
54pub use segment::{
55    AsyncSegmentReader, AsyncStoreReader, FieldStats, SegmentId, SegmentMeta, SegmentReader,
56};
57#[cfg(feature = "native")]
58pub use segment::{SegmentBuilder, SegmentBuilderConfig, SegmentBuilderStats};
59
60// Re-exports from query
61pub use query::{
62    BlockWand, Bm25Params, BooleanQuery, BoostQuery, MaxScoreWand, Query, Scorer, SearchHit,
63    SearchResponse, SearchResult, TermQuery, TopKCollector, WandResult, search_segment,
64};
65
66// Re-exports from tokenizer
67pub use tokenizer::{
68    BoxedTokenizer, Language, LanguageAwareTokenizer, LowercaseTokenizer, MultiLanguageStemmer,
69    SimpleTokenizer, StemmerTokenizer, Token, Tokenizer, TokenizerRegistry, parse_language,
70};
71
72// Re-exports from other modules
73pub use directories::SLICE_CACHE_EXTENSION;
74pub use error::{Error, Result};
75pub use index::{Index, IndexConfig, SLICE_CACHE_FILENAME};
76#[cfg(feature = "native")]
77pub use index::{IndexWriter, warmup_and_save_slice_cache};
78
79// Re-exports from wand
80pub use wand::{TermWandInfo, WandData};
81
82pub type DocId = u32;
83pub type TermFreq = u32;
84pub type Score = f32;