Skip to content

Bulk insert ngrams when updating document indexes - #54

Merged
dblock merged 1 commit into
mongoid:masterfrom
dblock:dblock/bulk-indexing
Oct 17, 2026
Merged

dblock merged 1 commit into
mongoid:masterfrom
dblock:dblock/bulk-indexing

Conversation

@dblock

@dblock dblock commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Use insert_many for Mongoid 5+ and the array form of Moped insert for Mongoid 3/4. Preserve ngram scores, filter metadata, and replacement behavior. Skip empty indexes without aborting later indexes on the document. Regression coverage asserts one driver insert call for a long title and covers empty indexes, replacement, filters, and multiple indexes.

Fixes #43. Search query batching and automatic dirty tracking are intentionally not included. Depends on #51.

Prepared by an AI on behalf of @dblock.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock force-pushed the dblock/bulk-indexing branch from a8c62e8 to d636370 Compare October 17, 2026 03:31
@github-actions

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@dblock
dblock merged commit 0d987dd into mongoid:master Oct 17, 2026
12 checks passed
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.

Bulk indexing - Saving a model with a long indexable name triggers as many queries as the number of ngrams

1 participant