Français
Presentations About Resources Store

Salesforce, Python, SQL, & other ways to put your data where you need it -- a bilingual blog in English & French

Need event music? 🎸

Live and recorded jazz, pop, and meditative music for your virtual conference / Zoom wedding / yoga class / private party with quality sound and a smooth technical experience

Algolia attributes are flexible

15 Oct 2020 🔖 jamstack
💬 EN

Ohhhhh, I GET IT. There’s nowhere in Algolia’s web UI, as you create an Algolia index, to define a schema for the data you plan to send it. Why not? Because it doesn’t care. 🤯

The only reason to use predictable, regular fields from one object to another is because after the fact, you use field names to determine what you care about with respect to searchability, and that could be a pain if you didn’t stick with a consistent word like “title.”

But Algolia doesn’t care if one “object” you pass it has a personName and another has a carMakeAndModel and yet another has a brand. It’s just more work for you to do to figure out that you probably could’ve uploaded all of these pieces of data as an item’s title if you’re just doing, say, search against different page types on a web site.

In other news, today I built a Netlify function that downloads all my data from a Sanity site as a list-of-objects, and another Netlify function that pushes a list-of-objects up into Algolia. (No, I haven’t hooked them up to each other – because I had this “aha moment” while trying to figure out how I wanted to go about doing so. My Sanity schema’s a hot mess, as in my example above, because I named things all sorts of crazy names for the purpose of making sure I didn’t rely on “magic coincidences” when hooking it up to stuff like 11ty.)

--- ---