uqa_storage_sqlite/
inverted_index.rs1use std::collections::{BTreeMap, BTreeSet};
10use std::sync::Arc;
11
12use rusqlite::types::Value as SqlValue;
13use rusqlite::{params, params_from_iter, OptionalExtension};
14use uqa_analysis::Analyzer;
15use uqa_core::{DocId, FieldName, IndexStats, Payload, PostingEntry, PostingList};
16
17use crate::connection::{ManagedConnection, Result as SQLiteResult, SQLiteError};
18use uqa_storage::block_max_index::{BlockMaxIndex, BlockMaxScorer, DEFAULT_BLOCK_SIZE};
19use uqa_storage::clustered_postings::{
20 ClusteredPostingCursor, EncodedScoreCluster, MaterializedPostingCursor, OccurrencePosting,
21 PostingCursor,
22};
23use uqa_storage::inverted_index::{
24 AnalyzerPhase, IndexedFieldMetadata, IndexedFieldRevision, InvertedIndex,
25};
26use uqa_storage::StorageBackendResult;
27use uqa_storage::TokenTermKey;
28
29#[derive(Clone)]
30pub struct SQLiteInvertedIndex {
31 conn: ManagedConnection,
32 table: String,
33 bindings: uqa_storage::inverted_index::AnalyzerBindings,
34}
35
36#[derive(Debug)]
37struct StagedField {
38 metadata: IndexedFieldMetadata,
39 postings: BTreeMap<TokenTermKey, Vec<uqa_core::TokenOccurrence>>,
40}
41
42mod block_max;
43mod clustered;
44mod codec;
45mod controlled;
46mod core;
47mod data;
48mod format;
49mod maintenance;
50mod mutation;
51mod queries;
52mod trait_impl;
53
54use clustered::{clustered_result, load_cluster, posting_cursor_from_rows, write_cluster};
55use codec::{
56 decode_index_u64, decode_index_usize, encode_index_counter, encode_index_u64,
57 encode_index_usize, invalidate_posting_accelerators, load_document_lengths, quote_ident,
58 table_exists,
59};
60
61#[cfg(test)]
62mod tests;