Search and filter APIs: query shape, facets and sorting
A search screen is a text box, filters with counts beside them, a sort menu and a list that loads more as you scroll. Search engines and inverted indexes covers the engine; this page covers the API in front of it.
Renting a flat through an agent
You walk into an estate agent's and ask for a flat with two bedrooms, under $2,000 a month, in Riverside or Hillside, and somewhere quiet. The agent narrows her book of listings by the yes-or-no parts: two bedrooms, the price, those two districts. Then she ranks what's left by how well each fits "quiet". First she tells you how many there are in each district and how many have a balcony, so you can change your mind. She hands you the ten best, and when you come back for more she carries on from where she stopped.
Her book of listings is the search index, a copy of the listings database. The yes-or-no parts are filters, which match or don't and add nothing to the ranking. "Somewhere quiet" is the text query, scored for relevance, and ordering by price instead would be a sort. "Forty in Hillside, twelve with a balcony" are facets, counts for each value of a field. The ten best are a page, and carrying on from where she stopped is the cursor.