Add skip_merge option for FTS indexes

This commit is contained in:
BubbleCal
2026-01-20 21:32:41 +08:00
parent 4da01a0e65
commit 4b24e28539
9 changed files with 40 additions and 2 deletions

View File

@@ -558,6 +558,12 @@ export interface FtsOptions {
* whether to only index the prefix of the token for ngram tokenizer
*/
prefixOnly?: boolean;
/**
* Whether to skip the partition merge stage after indexing.
* Useful for distributed indexing where merges are handled separately.
*/
skipMerge?: boolean;
}
export class Index {
@@ -726,6 +732,7 @@ export class Index {
options?.ngramMinLength,
options?.ngramMaxLength,
options?.prefixOnly,
options?.skipMerge,
),
);
}

View File

@@ -157,6 +157,7 @@ impl Index {
ngram_min_length: Option<u32>,
ngram_max_length: Option<u32>,
prefix_only: Option<bool>,
skip_merge: Option<bool>,
) -> Self {
let mut opts = FtsIndexBuilder::default();
if let Some(with_position) = with_position {
@@ -192,6 +193,9 @@ impl Index {
if let Some(prefix_only) = prefix_only {
opts = opts.ngram_prefix_only(prefix_only);
}
if let Some(skip_merge) = skip_merge {
opts = opts.skip_merge(skip_merge);
}
Self {
inner: Mutex::new(Some(LanceDbIndex::FTS(opts))),