Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| index | ||
| .saveObjects(coursesForIndex) | ||
| .then(({ objectIDs }) => { | ||
| console.log(objectIDs); | ||
| }) | ||
| .catch((err) => { | ||
| console.log(err); | ||
| }); |
There was a problem hiding this comment.
Are you going to update a single index by clearing it and then adding new data or doing this? iirc if you say run this twice in succession you'll have duplicate records in the index. I think the objectID should make it so it doesn't but just want to check in.
There was a problem hiding this comment.
What is the plan for stale courses? ie. courses that don't exist anymore cause this will make it so some will linger.
There was a problem hiding this comment.
yep you're right! I ran this twice and I don't get duplicate records because of the objectID field. What it does is replace all other fields in the object aside from the ID (which in our case will be the subject+code)
but hmmm that's a good point 🤔 wiping it clear and then populating might be good, and switching to replaceAllObjects seems easy enough
but then it worried me about anything going wrong with the API (e.g. running the script with 202401 currently will return 0 courses to be added since API is not working, so it would simply wipe the index instead of not touching it at all). What do you think?
aomi
left a comment
There was a problem hiding this comment.
Also, you'll want to set up synonyms for stuff like ELEC == ECE and "computer science" == csc etc., (people do search sometimes spelling the entire subject 🤷 )
| subject: course.subject, | ||
| code: course.code, |
There was a problem hiding this comment.
Having a field that's just the concatenation like objectID helps with cases where people enter CSC100 without a space.
There was a problem hiding this comment.
is objectID not taken into consideration for the search?
There was a problem hiding this comment.
and re: synonyms for courses, are you thinking a sort of look up table with pre defined synonyms for the most common stuff?
Description
This PR adds a TS script to generate a new algolia index and update it so that search has latest data.
I got it to work with my own algolia account and it seems to be working if those are the only fields needed.
It also adds a GH Action script we can dispatch to update the specified term
Closes #444
Checklist