-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for subcategory backfill (redo) #93
Conversation
Co-Authored-By: Micha <[email protected]>
It closes: #17 |
FYI @guenth39 @jasonbosco I have fixed previous issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vazome Thank you for the PR! Could you add an integration test with a sub-collection?
@jasonbosco could you please elaborate, I should make a test in the code itself or something different? UPD: okay let's see |
@jasonbosco tests included, please verify UPD: fixed syntax error |
Okay, I see the errors, forgot to do ESlint |
Corrected the wrong indent and missing new line |
Hey, I saw that the tests were failing, so I took a closer look and tried to debug it myself. Turns out, if you log the value: const typesenseDocsStr = await typesense.collections(encodeURIComponent(typesenseSubcollectionName)).retrieve();
console.dir(typesenseDocsStr); The collection has no documents present: {
created_at: 1731922232,
default_sorting_field: '',
enable_nested_fields: true,
fields: [
{
facet: false,
index: true,
infix: false,
locale: '',
name: '.*',
optional: true,
sort: false,
stem: false,
store: true,
type: 'auto'
}
],
name: 'books_firestore/1/subcollection',
num_documents: 0,
symbols_to_index: [],
token_separators: []
} What's also interesting is one in two runs, the test fails to delete the existing collection, resulting in a 409 from the server |
#99 was merged, and latest builds should support subcollections now |
Change Summary
@vazome – Improves upon #72. I took into account that orginal file was renamed and put subcategory backfill logic explanation into REAME.
Tested this change in Cloud Functions, it works.
@guenth39 – With these changes, the backfill will now work also for subcollections, not only for "root" collection. If the collection path is something like users/{userId}/items the sync has already worked, but the backfill did not as the documents were queried with this collection path, but that did not work. Instead, we use the collectionGroup feature now with only the last part of the path.
PR Checklist