Is it possible to create a search function in the datastore?

CatWeb

I saw a search function implementation in this game.
Was it possible to implement the search function with datastore? Or is this an external database?

1 Like

Now, the search functionality you have seen in this game could be done in several ways, given what needs and restrictions the project is. All of that will further be described below.

Using Datastore

The principal purpose of Datastore in Roblox is to save player data, game configurations, and other types of information specific to your game. However, using Datastore for a search function might be pretty complex and ineffective for some reasons:

  1. Complex Querying: Datastore does not support complex querying. You would have to load up your whole dataset and search through it manually in Lua. That is slow and resource-intensive.
  2. Rate Limits: Datastore has strict rate limits, and frequent searching might easily overflow these limits, causing throttling.
  3. Scalability Issues: With growing data, the act of searching through Datastore just gets impractical.

External Database

This would be of particular interest when more powerful search functionalities are called for, in which case external databases would be of more relevance. Here’s why:

  1. Advanced Querying: External databases—MySQL, PostgreSQL, or NoSQL databases like MongoDB—support complex queries and hence could efficiently help in searching.
  2. Scalability: External databases are designed to deal with huge data and can scale with your needs.
  3. Flexibility: You might want to use a robust search engine like Elasticsearch efficiently to handle your search functionality.

Implementing with an External Database

  1. Backend Server: You will need to create a backend server using Node.js, Python, or the language of your choice. It’ll pass and receive information between your Roblox game and the database.
  2. Database: You may use any SQL or NoSQL database as per desire. Configure all configurations as per your need in your database where data will be stored.
  3. API: On your backend server, design an API to conduct the searching. These API endpoints will handle the requests that will be passed in from your Roblox game.
  4. Alternative: Roblox’s Http Service: Send the search queries to your backend server using the HttpService of Roblox. It then parses the response and renders the results within your game.

Example Workflow

  1. User Input: Player enters a search term in your Roblox game.
  2. HTTP Request: The game sends an HTTP request to your backend server accompanied by the search words.
  3. Server Processing: The backend server processes the request, queries the database, and retrieves the results.
  4. Response: The server responds and sends the search results back to the game.
  5. Display Results: The game displays the results of the search to the player.

Conclusion

While it’s technically possible to make a search function using Datastore, it’s not recommended due to performance and scalability issues. External databases are the efficient solution for implementing search in a Roblox game. (But, They probably used a scroll frame and slapped 165 UI instances in it and such, probably a script to make the URLs and titles + descriptions different.)

2 Likes