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, BitpackedPostingIterator, BitpackedPostingList, BlockPostingList,
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, SegmentBuilder, SegmentId, SegmentMeta,
56    SegmentReader,
57};
58
59// Re-exports from query
60pub use query::{
61    BlockWand, Bm25Params, BooleanQuery, BoostQuery, MaxScoreWand, Query, Scorer, SearchHit,
62    SearchResponse, SearchResult, TermQuery, TopKCollector, WandResult, search_segment,
63};
64
65// Re-exports from tokenizer
66pub use tokenizer::{
67    BoxedTokenizer, Language, LanguageAwareTokenizer, LowercaseTokenizer, MultiLanguageStemmer,
68    SimpleTokenizer, StemmerTokenizer, Token, Tokenizer, TokenizerRegistry, parse_language,
69};
70
71// Re-exports from other modules
72pub use directories::SLICE_CACHE_EXTENSION;
73pub use error::{Error, Result};
74pub use index::{Index, IndexConfig, SLICE_CACHE_FILENAME};
75#[cfg(feature = "native")]
76pub use index::{IndexWriter, warmup_and_save_slice_cache};
77
78// Re-exports from wand
79pub use wand::{TermWandInfo, WandData};
80
81pub type DocId = u32;
82pub type TermFreq = u32;
83pub type Score = f32;