-
Notifications
You must be signed in to change notification settings - Fork 19
Add fieldsToIndex as option in backfill script #139
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
Conversation
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.
Well done!!! 🎉
I made a few comments
functions/src/import/index.ts
Outdated
@@ -94,14 +98,15 @@ async function retrieveCollectionFromFirestore( | |||
* Adapts documents and indexes them in Meilisearch. | |||
* @param {any} docs |
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.
Why we use any
instead of DocumentSnapshot[]
here?
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.
I thought the previous one was a mistake @param {Change<DocumentSnapshot>} change
since change
is not docs
. But you'r right, putting it back :)
const document = adaptDocument( | ||
documentId, | ||
after, | ||
config.meilisearch.fieldsToIndex || '' |
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.
Same about:
fieldsToIndex: process.env.MEILISEARCH_FIELDS_TO_INDEX || '',
Is it not the same parameter?
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.
because the type of MeilisearchConfig
specifies that it can be an undefined
export type MeilisearchConfig = {
host: string
apiKey: string
indexUid: string
fieldsToIndex?: string
}
And typescript does not infer that the variable was already set to string in config so it raises an error
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
functions/src/import/config.ts
Outdated
@@ -48,6 +48,7 @@ program | |||
'-a, --api-key <api-key>', | |||
'The Meilisearch API key with permission to perform actions on indexes. Both the private key and the master key are valid choices but we strongly recommend using the private key for security purposes.' | |||
) | |||
.option('-f, --fields-to-index <fields-to-index>', 'test') |
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.
What is test
?
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.
Oops
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.
Well Done 🚀
LGTM! ✨
bors merge |
Build succeeded: |
fixes: #134
The
fieldsToIndex
option was missing in the backfill script.Example now: