Queries

Search

One search value matched across the fields you allow, relations included.

Search matches one value against one or more fields, case-insensitively, as a substring. A row matches when any of the searched fields contains the value.

  
search
: {
value
: string; // the text to look for
fields
: string[]; // [] searches the resource's default fields
}; };

The value is trimmed first. An empty value, or one made only of spaces, adds no condition.

Which fields are searched

The request sendsFields searched
fields: []The resource's search.defaults.
fields: ["…", "…"]Those fields. Each must be in search.allowed, or the request is rejected.
  
search
: {
allowed
: ["reference", "customer.name", "orderLines.product.name", "orderLines.product.sku"],
defaults
: ["reference", "customer.name"],
}, } satisfies {
search
:
ExampleSearchConfig
};

allowed is everything a client may opt into. defaults is what most users want searched. Without allowed, every field path is searchable.

Try it

The sample resource searches reference and customer.name by default. Edit value, or list fields such as "orderLines.product.name".

Search with the default fields real engine · 10,000 sample orders in your browser
requestplayground →
{
  "search": {
    "value": "north",
    "fields": []
  },
  "sorting": [
    {
      "key": "createdAt",
      "dir": "desc"
    }
  ]
}
Runs when scrolled into view.

The SQL

Each field becomes lower(column) LIKE '%value%', and the fields are combined with OR. A field on a relation is checked inside EXISTS, so a missing optional relation can't hide a row that matches another field:

WHERE (
  lower(orders.reference) LIKE '%laptop%'
  OR EXISTS (
    SELECT 1 FROM customers
    WHERE customers.id = orders.customer_id
      AND lower(customers.name) LIKE '%laptop%'
  )
)
-- combined with the scope and the filters with AND

On PostgreSQL, a selective search over indexed text fields of several tables can use a cheaper plan; the engine compares estimates before choosing it. See Performance.

Keep defaults short: every default field adds a condition to every search, and many-to-many paths add a subquery each.

Copyright © 2026