Skip to content

fix: preserve live collection during alias-based reindex#24

Merged
jasonbosco merged 4 commits intotypesense:masterfrom
tharropoulos:alias-swap-fix
Mar 31, 2026
Merged

fix: preserve live collection during alias-based reindex#24
jasonbosco merged 4 commits intotypesense:masterfrom
tharropoulos:alias-swap-fix

Conversation

@tharropoulos
Copy link
Copy Markdown
Contributor

Change Summary

PR Checklist

@jasonbosco jasonbosco merged commit 38c4932 into typesense:master Mar 31, 2026
2 checks passed
@haleyngonadi
Copy link
Copy Markdown

haleyngonadi commented Apr 1, 2026

hi @tharropoulos, it's me again :)

Do you think this will also resolve the issue of joins requiring re-indexing when the alias of one of their references changes? For example, when I run Book.reindex, and I have it referenced in another model like so: { "name" => "book_id", "type" => "string", "reference": "#{::Book.index_name}.id" }, I immediately get an error afterwards: "No reference field found." but the reference existed until I had to reindex.

@tharropoulos
Copy link
Copy Markdown
Contributor Author

@haleyngonadi It should fix that case as well, as the alias was dangling before this fix. I actually just wrote a test to verify that joins continue to work when reindexing the referenced collection.

That said, I'd still be a little careful about generalizing too far from one passing case. With JOINs, when aliases are used in reference fields, related collections may need to be reindexed together because of how internal reference IDs are handled. Here're some docs around Aliases with JOINs

@dpashutskii
Copy link
Copy Markdown

Thank you for fixing it. @tharropoulos, will you ship a new gem release?

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.

reindex causes downtime when alias is already set up, delete_collection called before new collection is ready

4 participants