Skip to content

fix: build list FTS indexes as row documents#7656

Merged
Xuanwo merged 3 commits into
mainfrom
xuanwo/fts-list-row-docs
Jul 7, 2026
Merged

fix: build list FTS indexes as row documents#7656
Xuanwo merged 3 commits into
mainfrom
xuanwo/fts-list-row-docs

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Close #5887

Build FTS indexes for list string columns as row-level documents instead of flattening each list element into its own document.

This means List<Utf8>, List<LargeUtf8>, and their LargeList variants now treat a row as one document, with non-null list elements contributing text fragments to that document. Token positions are continuous across list elements, so phrase queries can match across element boundaries.

The change intentionally does not add user parameters, persistent metadata, legacy migration, or query-side deduplication. Old list indexes keep their existing behavior.

Context

Issue #5887 reports duplicate FTS results for list string columns because the old index builder treated each list element as a separate document with the same row id. Row-level indexing fixes the result duplication and brings BM25 document statistics back to row-level semantics for newly built indexes.

Follow-up issue #7654 tracks MemWAL in-memory FTS support for list string columns.

Validation

  • cargo fmt --all
  • git diff --check
  • cargo test -p lance-index flat_bm25_search
  • cargo test -p lance-index test_worker_
  • cargo test -p lance test_fts_list
  • cargo test -p lance test_fts_index_with_
  • cargo clippy -p lance-index --tests -- -D warnings
  • cargo clippy -p lance --tests -- -D warnings

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer bug Something isn't working labels Jul 7, 2026
@Xuanwo
Xuanwo marked this pull request as ready for review July 7, 2026 08:09
posting_memory_delta +=
new_posting_memory_size as i64 - old_posting_memory_size as i64;
token_num += 1;
last_position = Some(position);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

["want the", "apple"] would be treated as "want apple" with positions [0, 1]
but "want the apple" would be "want apple" with positions [0, 2] (the stop words also contribute to the position increment)

Comment thread rust/lance-index/src/scalar/inverted/builder.rs
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.96175% with 77 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-index/src/scalar/inverted/index.rs 66.04% 55 Missing ⚠️
rust/lance-index/src/scalar/inverted/builder.rs 89.21% 12 Missing and 10 partials ⚠️

📢 Thoughts on this report? Let us know!

@Xuanwo
Xuanwo merged commit 5e9c196 into main Jul 7, 2026
33 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/fts-list-row-docs branch July 7, 2026 10:01
BubbleCal pushed a commit that referenced this pull request Jul 7, 2026
…igurable

Resolves the process_document conflict against the list-FTS
restructure (#7656): keep main's DocumentSource/process_text closure
shape and thread this branch's posting block_size through the
PostingListBuilder construction sites (position closure and the
positionless resize_with).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FTS on list of strings returns duplicate results

2 participants