Skip to content

feat(indexing): advise payload splitting and soft-commit per call - #196

Open
adityamparikh wants to merge 3 commits into
apache:mainfrom
adityamparikh:feat/indexing-batch-guidance
Open

feat(indexing): advise payload splitting and soft-commit per call#196
adityamparikh wants to merge 3 commits into
apache:mainfrom
adityamparikh:feat/indexing-batch-guidance

Conversation

@adityamparikh

Copy link
Copy Markdown
Contributor

Summary

Two small changes to the inline indexing tools (index-json-documents, index-csv-documents, index-xml-documents, index-markdown-documents).

  • Payload-splitting guidance. Inline payloads are generated by the model as tool arguments, so one oversized call is truncated at the model's output limit and fails to parse. The server instructions now tell the model to split inputs larger than a few hundred KB across several calls, and each inline tool description carries a one-clause reminder. The guidance is a size rather than a document count because record sizes vary widely. The JSON description also notes that CSV costs fewer tokens for large flat records.
  • Soft commit per call. Splitting multiplies commits, so indexDocuments now ends with a soft commit (waitFlush=false, waitSearcher=true, softCommit=true) instead of a hard commit. Documents are still searchable when the tool returns; the segment fsync is left to Solr's autoCommit, which the _default configset enables at 15 s. The transaction log covers durability in between. README notes that a configset with autoCommit disabled should enable it.

Tests

  • IndexingServiceTest verifies the soft-commit overload is used and the hard-commit overload is not.
  • McpToolRegistrationTest fails if any index-* tool description drops the splitting guidance.
  • New McpServerInstructionsTest guards the instructions text in application.properties.

Verification

./gradlew build on Java 25: 407 tests, 0 failures, 7 skipped. Spotless applied.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV

Inline indexing payloads are generated by the model as tool arguments, so a
single oversized call is truncated at the model's output limit and fails to
parse. Tell the model, once in the server instructions and briefly in each
inline indexing tool description, to split inputs larger than a few hundred
KB across several calls. The guidance is a size, not a document count,
because record sizes vary widely.

Splitting multiplies commits, so indexDocuments now ends with a soft commit
(waitFlush=false, waitSearcher=true, softCommit=true) instead of a hard
commit: documents are searchable when the tool returns, while the segment
fsync is left to Solr's autoCommit (15 s in the _default configset). The
README documents the trade-off for operators whose configset disables
autoCommit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
adityamparikh and others added 2 commits September 12, 2026 13:49
Replace the concatenated string descriptions on the four inline indexing
tools with text blocks, matching the style SearchService already uses. The
payload-splitting sentence is now spelled out in each block instead of
being appended from a constant; McpToolRegistrationTest still guards it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
The splitting clause was repeated in all four tool descriptions and in the
server instructions, contradicting the rule the new instructions test states.
The tool descriptions revert to main; the instructions carry the guidance,
and the per-tool registration test goes with it. The instructions test now
asserts the actual clause instead of any sentence containing 'commit'. The
unit test's when(commit(...)).thenReturn(null) stubs were no-ops and are
dropped. README keeps one sentence on the soft commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant