How would I go about searching through a DataStore?

Heya. After a few hours of headaches (and about 7 crumpled notes) I’ve decided to drop the question; In a DataStore where I could expect hundreds of objects being pushed to it every day, and if not thousands of reads every 3-4 hours, how would I go about a search module that scans the datastore?

I solo develop a (currently in creation, this is the last thing I need lol) avatar creator like game, and its avatar editor has a part for user submitted outfits. I have already figured out pulling avatars/outfits from users, and directly importing avatars using a “share-code,” but never a user search.

I was expecting users to search via the designer’s set tags/name. eg. ( A user queries “dog”, the server will return outfits containing dog, like “dog”, “doggo”, etc. and in its tags, such as “dog outfit”.)

Can I do this via Roblox’s datastore, or will I have to pull my hair off (again) with mongo and redis?

“thsnks” - Wren

If you have a DataStore that contains every single user-generated outfit, this should be possible as long as each outfit has some sort of tag or name that might contain a common search phrase or keyword.

For example, how I would go about doing this is whenever a user searches for a custom outfit, I would get the UserGeneratedOutfit datastore using whatever key you have for it, then search through the dictionary for any indices that match the keyword the user typed. So if a user is looking for dog outfits, any and all user-generated outfits that have “dog” in the name will have their data retrieved and then displayed to the player.

This is definitely possible with Roblox datastores, you just have to make sure you format your data correctly. I’m not sure how I would account for spelling errors or anything like that, so I guess just include a note to the user to make sure they spell everything correctly. Also, I would use string:lower() on the user’s input to ensure there are no capitals, and everything is kept lowercase.

Edit: The only limiting factor here is that since you said this datatore would be getting thousands of requests an hour, you could have some problems with the rate limit. You might wanna make a queue system for new uploads so you don’t throttle the :SaveAsync() or :UpdateAsync() requests. Same thing for :GetAsync().