1. Section Intro
Notes
If you have any list with more than a dozen items to show, search makes it easier for users to find what they're looking for.
When implementing search, there are many requirements to consider:
- Should search be implemented client-side or server-side?
- Should we debounce the keyboard input events and implement rate limiting on the client so that we don't make too many network requests?
- Should we support pagination?
- Should our search algorithm be fuzzy and take into account spelling mistakes?
- Where should it search from? A single property, multiple properties from a single table, or the entire database (full-text search)?
- How big is the search database? And is it centralized or distributed?
- Should we cancel requests if the search query changes before we get a response from the previous one?
- Should we cache previously saved search results?
- Should we sort search results based on one or more criteria?
- Do we want to see search suggestions as we type so that we can more easily complete our query?
Search in the eCommerce app
The goal of this section is to implement a basic product search feature, so that we can type the name of a product and get a list of matching results.
As we will see, Riverpod gives us all the APIs that we need to implement search efficiently.
For now, we'll implement client-side search by using the FakeProductsRepository
as the database that contains all the products,
And in the next course about Flutter & Firebase, we will explore two solutions to implement server-side search:
- using Cloud Firestore, which has some limitations
- using Algolia, which is a paid service that gives us more powerful search capabilities.
0 comments