The data
Create a Private silo namedcatalog with this JSON. Search works on a top-level array, so the products are the root of the document.
catalog.json
Terminal
Recipes
Get one product by position
Get one product by position
idx picks one item from the array, counting from 0.Response
Get one field of one product
Get one field of one product
Add
path to idx to read a single field.Response
Convert a field's type
Convert a field's type
output converts the value picked by path. Here the price comes back as text.Response
Products under a price
Products under a price
Search with
op=lt (less than). gt and lt compare as numbers.Response
Name contains a word
Name contains a word
il matches a pattern, ignoring case. % is the wildcard and must be sent as %25 in a URL.Response
Products with a tag
Products with a tag
A double dot (
..) looks inside an array on each product. A product matches when any of its tags matches.Response
Combine two conditions
Combine two conditions
Repeat Only one product matches, so it comes back on its own, not in an array:
q, value, and op for each condition. All of them must match.Response
Just the names of matching products
Just the names of matching products
Add
path to a search to pick one field from each match.Response
A small client
Search returns an array for two or more matches, a single object for one match, and404 for none. This helper smooths that out, so your code always gets an array.
A
404 can also mean a wrong UUID or region. If every search returns nothing, read the silo without parameters first to check the URL.Good to know
- Results are cached for up to 5 minutes. A search right after you update the catalog may return the previous data.
- Every query is a read. Queries and searches count towards the silo’s rate limit like any other private silo read.
- No sorting or paging. Sort and slice the results in your own code.
- Private silos only. A public silo always returns the whole document.