Skip to content

feat(fts): support selecting a logical index by name - #11745

Open
skyshineb wants to merge 1 commit into
lance-format:mainfrom
skyshineb:feat/fts-index-name
Open

skyshineb wants to merge 1 commit into
lance-format:mainfrom
skyshineb:feat/fts-index-name

Conversation

@skyshineb

Copy link
Copy Markdown
Contributor

With multiple FTS indices on a column, ordinary queries currently use an implicit index. For example, an index using the simple tokenizer matches hello in both hello and hello world, while one using the raw tokenizer matches only hello; callers cannot choose between them. This PR adds explicit logical index selection through dataset planning and execution.

This is PR 2 of 2 for #11725, following merged PR #11728's UUID resolution across the dataset snapshot. Closes #11725.

  • Rust adds Scanner::with_fts_index_name, load_segments_with_index_name, and additive name builders/getters on the FTS execution nodes. Existing public query structs and constructors remain usable.
  • Python accepts index_name on the FTS builder and FTS filter, including dictionaries containing string or typed queries. Java adds FtsQueryOptions for synchronous/asynchronous scans and existing export of global statistics. SQL fts() and hybrid() accept the name in their options JSON.
  • Planning infers omitted fields/granularity from the named index and rejects unknown names, wrong index types, incompatible fields/granularity, and multi-field targets. Explicit names must agree with supplied segment UUIDs. Selection survives plan reconstruction and is used for coverage, residual analysis, reranking, overlays, exact total hits and statistics.

A valid index with empty coverage remains selectable: its analyzer is retained for unindexed rows. This does not add a strict no-scan policy. Unnamed selection, partial-coverage scoring contracts, and vector-candidate FTS reranking semantics remain unchanged. MemWAL/LSM selection, per-field name maps and storage-format changes are outside this PR.

Tests use small multi-fragment datasets with different analyzers and cover full/partial/empty coverage, fuzzy matching and scores, list/null cases, updates/deletions, name/UUID errors, reconstruction, binding copies/replacement, SQL/hybrid queries, vector filtering/reranking, total hits and statistics identity. The guide includes examples for each exposed API.

Validation:

  • Rust: 1,053 FTS tests, 74 hybrid UDTF integration tests, and the named-API/FTS execution doctests passed. Full workspace Clippy (--all --tests --benches -- -D warnings) and formatting passed using the repository's CI profile for native checks.
  • Python: the prescribed source build passed using the existing CI profile; 38 focused tests and uv run make lint passed. Pyright reported 0 errors and 18 existing dependency-stub/source warnings.
  • Java: 26 FTS tests and 39 JNI unit tests passed through Maven. Checkstyle, Spotless, JNI Clippy with warnings denied, and JNI formatting passed.
  • Repository commit hooks passed. No dependency, lockfile, or persisted-format changes.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added A-python Python bindings A-java Java bindings + JNI A-docs Documentation enhancement New feature or request labels Dec 2, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

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.

✅ Gate recommendation: approve.

No blocking issues found in named selection or its fallback and statistics paths.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Dec 2, 2026
@Xuanwo

Xuanwo commented Dec 2, 2026

Copy link
Copy Markdown
Member

(AI-assisted comment)

Could you update this branch with main at or after 47516fce7f so Java CI tests the named-index changes with #11742 included? Only the author can update this fork branch.

Java 21 exited with status 139 in OptimizeIndicesTest on both this PR and the preceding main. All four JDKs passed on main after #11742 landed. PR job · Earlier main job · Passing main matrix

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. and removed K-approved Latest Gatekeeper recommendation permits acceptance. labels Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docs Documentation A-java Java bindings + JNI A-python Python bindings enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: FTS queries cannot target a non-default logical index

2 participants