Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 4, 2026

feat(tantivy): improve batching, concurrency, and index versioning

Summary

This PR improves the tantivy search plugin with three main changes:

  1. Concurrency improvements: Replaced Mutex with RwLock so search operations can run concurrently without blocking writes. Searches now use read locks while write operations use write locks.

  2. Batching/commit strategy: Implemented the previously unused auto_commit config with configurable commit_interval_ms. When enabled, writes are batched and only committed when the interval has elapsed, reducing commit overhead for frequent transcript updates.

  3. Index versioning: Added SCHEMA_VERSION constant and version tracking. On startup, if the stored version doesn't match the current schema version, the index is automatically re-created.

  4. Auto-flush on exit: Pending writes are automatically flushed when the app exits via RunEvent::ExitRequested.

Updates since last revision

  • Fixed unrelated formatting issues in useKeywords.ts and chat-shortcuts/index.ts to pass CI lint checks

Review & Testing Checklist for Human

  • Critical: Verify the try_write() in the exit handler (lib.rs:189) - if it fails to acquire the lock, pending writes will be silently lost. Consider if this is acceptable or if blocking should be used.
  • Important: Test the batching behavior - with commit_interval_ms: 1000, writes won't be immediately searchable. Verify this is acceptable for the transcript update use case.
  • Important: The flush() method in ext.rs (lines 585-612) appears to be dead code since the flush command was removed. Consider removing it.
  • Test schema version change triggers re-index by manually changing SCHEMA_VERSION and verifying the index is recreated on app restart.

Recommended test plan:

  1. Start the app and add several documents in quick succession
  2. Verify searches work correctly
  3. Force-quit the app during active writes and verify data isn't lost on restart
  4. Change SCHEMA_VERSION to 2, restart, and verify re-indexing occurs

Notes

  • Default commit interval is 1000ms (1 second)
  • Schema version starts at 1
  • The version file is stored alongside the index at {index_path}/schema_version

Link to Devin run: https://app.devin.ai/sessions/0a50f5a4f3814dd29fabf7224cee142b
Requested by: yujonglee (@yujonglee)

- Replace Mutex with RwLock for better read concurrency (searches don't block writes)
- Implement configurable auto_commit with commit_interval_ms for batching writes
- Add schema versioning to detect and re-index on schema changes
- Auto-flush pending writes on app exit via RunEvent::ExitRequested

Co-Authored-By: yujonglee <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Jan 4, 2026

Deploy Preview for howto-fix-macos-audio-selection canceled.

Name Link
🔨 Latest commit c581a63
🔍 Latest deploy log https://app.netlify.com/projects/howto-fix-macos-audio-selection/deploys/695a69ce4fad2600088130fb

@netlify
Copy link

netlify bot commented Jan 4, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit c581a63
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/695a69ce94c2c700085f2acf

@netlify
Copy link

netlify bot commented Jan 4, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit c581a63
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/695a69cff940cb0008d2aec6

@yujonglee yujonglee merged commit 15dfbab into main Jan 5, 2026
21 of 22 checks passed
@yujonglee yujonglee deleted the devin/1767532003-tantivy-improvements branch January 5, 2026 12:42
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.

2 participants