Skip to content

feat(java): align inverted index options - #8829

Open
ddupg wants to merge 2 commits into
lance-format:mainfrom
ddupg:feat/ddu-362-java-inverted-index-parity
Open

feat(java): align inverted index options#8829
ddupg wants to merge 2 commits into
lance-format:mainfrom
ddupg:feat/ddu-362-java-inverted-index-parity

Conversation

@ddupg

@ddupg ddupg commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • align Java tokenizer support with PyLance and the existing Java API documentation by enabling Jieba and Lindera in the Java JNI artifact, with a lightweight Jieba indexing and search test
  • expose the remaining Rust inverted-index build options through the Java builder
  • preserve source compatibility for the ineffective skipMerge option while deprecating it and stopping serialization of the unsupported field

Test plan

  • ./mvnw test (before rebasing onto the latest main)
  • cargo fmt --manifest-path java/lance-jni/Cargo.toml --all -- --check
  • cargo clippy --tests --manifest-path java/lance-jni/Cargo.toml
  • ./mvnw -Dtest=InvertedIndexParamsTest test after the final test cleanup

@github-actions github-actions Bot added A-java Java bindings + JNI A-deps Dependency updates enhancement New feature or request labels Aug 27, 2026
@ddupg
ddupg force-pushed the feat/ddu-362-java-inverted-index-parity branch from 0cbdb5b to 8d25b60 Compare August 27, 2026 14:31
@ddupg
ddupg marked this pull request as ready for review August 28, 2026 03:34
ddupg added 2 commits August 28, 2026 11:34
Expose the Rust inverted-index configuration in Java and enable the model-backed tokenizers already documented by the binding.
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
@ddupg
ddupg force-pushed the feat/ddu-362-java-inverted-index-parity branch from 5cb2513 to acb47ed Compare August 28, 2026 03:34

@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: request changes.

The new Java code-analyzer preset currently cannot cross the generic Rust parameter boundary, so it cannot create an index. #8779 independently fixes that sparse-parameter resolution path; merge it first, rebase this PR, and add JNI-backed code-analyzer coverage to verify the preset end to end.

}
Map<String, Object> params = new HashMap<>();
if (analyzer != null) {
params.put("analyzer", analyzer);

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.

analyzer("code") is serialized without base_tokenizer, but resolved_inverted_params currently overlays that sparse JSON onto the full text defaults, retaining base_tokenizer="simple". The newly exposed Java preset therefore cannot create an index. #8779 removes that eager default merge and is an independently mergeable prerequisite; after it lands, please rebase this PR and add this JNI-backed case so the preset is covered across the boundary.

Reproducer run against acb47ed

Add to LanceScannerFullTextSearchTest:

@Test
void testCodeAnalyzerBuilderCreatesIndex() throws Exception {
  ScalarIndexParams params = InvertedIndexParams.builder().analyzer("code").build();
  runFtsQuery(
      "memory://fts_java_code_analyzer",
      FullTextQuery.match("hello", "doc"),
      1L,
      Arrays.asList("helloWorld", "other_value"),
      params);
}

Run:

./mvnw -Djava.io.tmpdir=/home/agent/tmp/lance-gate-8829 -Dtest=LanceScannerFullTextSearchTest#testCodeAnalyzerBuilderCreatesIndex test

Expected: index creation succeeds and the query returns one row.

Observed: RuntimeException: Invalid user input: analyzer='code' requires base_tokenizer='code', got 'simple'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed that #8779 should land first. Once it is merged, I’ll rebase this PR

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.

Thanks. The current head is unchanged, so the finding remains pending until #8779 lands, this PR is rebased, and the JNI regression is added.

@lance-gatekeeper lance-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-deps Dependency updates A-java Java bindings + JNI enhancement New feature or request K-changes Latest Gatekeeper recommendation requests changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant