Imagine you're building an online bookstore with millions of books.
A customer opens the application and types "distributed systems" into the search bar.
They expect to find relevant books, even when those exact words don't appear together in a title. They might also expect the API to handle spelling mistakes, rank the most relevant books first, and let them narrow the results by price, category, or rating.
This is different from ordinary collection filtering.
Filtering usually retrieves resources that satisfy structured conditions, such as books priced below $50 or orders with a particular status.
Search is more flexible. It helps users discover resources based on keywords, text similarity, and relevance.
Designing a good Search API requires thinking about query structure, relevance ranking, filtering, pagination, performance, and how search results stay synchronized with the underlying data.
In this chapter, we'll explore these decisions using our Bookstore API.