indexing done by the profile and not table

This commit is contained in:
Priec
2026-04-29 01:08:59 +02:00
parent 1ceab57f3b
commit 036e12f345
2 changed files with 204 additions and 165 deletions

View File

@@ -5,9 +5,14 @@ use tantivy::schema::*;
use tantivy::tokenizer::*;
use tantivy::Index;
/// Returns the on-disk path for a profile/table search index.
pub fn search_index_path(root: &Path, profile_name: &str, table_name: &str) -> PathBuf {
root.join(profile_name).join(table_name)
/// Returns the on-disk path for a profile search index.
pub fn search_index_path(root: &Path, profile_name: &str) -> PathBuf {
root.join(profile_name)
}
/// Returns the unique index key for one table row inside a profile index.
pub fn search_row_key(table_name: &str, row_id: i64) -> String {
format!("{}:{}", table_name, row_id)
}
/// Creates a hybrid Slovak search schema with optimized prefix fields.
@@ -15,6 +20,8 @@ pub fn create_search_schema() -> Schema {
let mut schema_builder = Schema::builder();
schema_builder.add_u64_field("pg_id", INDEXED | STORED);
schema_builder.add_text_field("table_name", STRING | STORED);
schema_builder.add_text_field("row_key", STRING | STORED);
// For prefixes (1-4 chars).
let short_prefix_indexing = TextFieldIndexing::default()