Search
Pass q to /api/v1/{country}/laws and the
endpoint switches from listing to full-text search, ranked by
relevance. Filters, pagination and response formats work exactly the
same in both modes.
How results are ranked
Ranking is length-normalised, so the norm itself wins over the norms
that amend it — searching codigo penal returns the
Código Penal first, not the twenty laws whose titles quote it. A
title containing your query verbatim gets an extra boost.
Each result carries a title_snippet with the matched
terms already wrapped in <mark>, ready to render.
Searching by law number
Cite a norm the way a lawyer does — Ley 2/2026,
Ley Orgánica 10/1995 — and the number is matched exactly
rather than split into two loose digits. You get the norms carrying
that number, not every law published in 2026.
This works wherever the country writes the number into the title
(n/YYYY). Where it doesn't — Sweden's
1979:368, France's 2016-1321 — the query
falls back to fuzzy title matching, which also covers typos.
Filters and pagination
Every filter available when listing also applies to a search:
law_type, jurisdiction, year,
status, from_date, to_date,
sort. Results paginate with page and
per_page like any list, and total is the
true match count.
Auto-paginating a search needs Python SDK 0.2.1 or
newer. Earlier versions stop at the first page.
What search covers
Search runs over law titles, not the article text, and matches whole
words by prefix. That last point has a consequence worth knowing:
a plural does not find a singular. viviendas and
vivienda return different result sets, so search the
singular form when you want the widest net.