{"result":{"depiction_url":null,"edges":{"in_module":{"objects":[{"created":"2026-09-09T13:48:13Z","object_id":{"id":335,"is_a":["text","documentation","reference","module"],"name":"doc_core","title":"Zotonic Core","uri":"https:\/\/zotonic.com\/id\/335"},"seq":1}],"predicate":{"id":333,"is_a":["meta","predicate"],"name":"in_module","title":{"_type":"trans","tr":{"en":"In module"}},"uri":"https:\/\/zotonic.com\/id\/in_module"}},"references":{"objects":[{"created":"2020-05-30T05:48:17Z","object_id":{"id":2060,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_search","title":"mod_search","uri":"https:\/\/zotonic.com\/id\/2060"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"refers":{"objects":[{"created":"2026-09-09T13:48:13Z","object_id":{"id":2060,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_search","title":"mod_search","uri":"https:\/\/zotonic.com\/id\/2060"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"relation":{"objects":[{"created":"2020-05-30T05:48:17Z","object_id":{"id":1638,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_search","title":{"_type":"trans","tr":{"en":"Search"}},"uri":"https:\/\/zotonic.com\/id\/1638"},"seq":1000000},{"created":"2020-05-30T05:48:17Z","object_id":{"id":1396,"is_a":["text","documentation","reference","template_scomp"],"name":"doc_template_scomp_scomp_pager","title":"pager","uri":"https:\/\/zotonic.com\/id\/1396"},"seq":1000000},{"created":"2020-05-30T05:48:17Z","object_id":{"id":2060,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_search","title":"mod_search","uri":"https:\/\/zotonic.com\/id\/2060"},"seq":1000000},{"created":"2020-05-30T05:48:17Z","object_id":{"id":1575,"is_a":["text","documentation","cookbook"],"name":"doc_cookbook_custom_search","title":"Custom search","uri":"https:\/\/zotonic.com\/id\/1575"},"seq":1000000}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}},"subject":{"objects":[{"created":"2026-09-09T13:48:13Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:48:13Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-09-09T13:48:13Z","object_id":{"id":2586,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_search_and_discovery","title":"Search and discovery","uri":"https:\/\/zotonic.com\/id\/2586"},"seq":3},{"created":"2026-09-09T13:48:13Z","object_id":{"id":2625,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_model","title":"Model","uri":"https:\/\/zotonic.com\/id\/2625"},"seq":4},{"created":"2026-09-09T13:48:13Z","object_id":{"id":2643,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_query","title":"Query","uri":"https:\/\/zotonic.com\/id\/2643"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1844,"is_a":["text","documentation","reference","model"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1844"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_model_model_search","page_url":{"en":"https:\/\/zotonic.com\/docs\/1844\/search","x-default":"https:\/\/zotonic.com\/docs\/1844\/search"},"preview_url":null,"resource":{"version":3987,"pivot_location_lat":null,"title":"search","is_authoritative":true,"body":"<p>The m_search model provides access to different kinds of search queries for searching through models.<\/p>\n<p>Most searches in Zotonic are implemented in the <a href=\"\/id\/doc_module_mod_search\" class=\"doc-reference doc-reference-module\"><code>module#mod_search<\/code><\/a> module, searching through the\n<code>rsc<\/code> table in different kinds of ways.<\/p>\n<p>Though, any module can implement a search by observing the <code>search_query<\/code> notification.<\/p>\n<p>The search module is used inside templates. For example, the following snippet fetches the latest 10 modified pages in\nthe &quot;text&quot; category:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% for id in m.search[{latest cat=&quot;text&quot; pagelen=10}] %}\n    {{ m.rsc[id].title }}\n{% endfor %}\n<\/code><\/pre>\n<p>Another example, searching for a text and requesting the second page with 20 results at a time:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% for id, rank in m.search.paged[{fulltext text=query_string page=2 pagelen=20}] %}\n    {{ m.rsc[id].title }}\n{% endfor %}\n<\/code><\/pre>\n<h2>Available Model API Paths<\/h2>\n<table class=\"table\"><thead><tr><th>Method<\/th><th>Path pattern<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>get<\/code><\/td><td><code>\/paged\/+searchname\/...<\/code><\/td><td>Run named search <code>+searchname<\/code> with request arguments and return paged search results.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/count\/+searchname\/...<\/code><\/td><td>Run named search <code>+searchname<\/code> and return only the total match count.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/paged\/+name_props_searchprops\/...<\/code><\/td><td>Run deprecated tuple-style search (<code>{Name, Props}<\/code>) and return paged results.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+name_props_searchprops\/...<\/code><\/td><td>Run deprecated tuple-style search (<code>{Name, Props}<\/code>) and return non-paged results.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/paged<\/code><\/td><td>Run search from payload\/query arguments and return paged results. No further lookups.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/count<\/code><\/td><td>Run search from payload\/query arguments and return only the count. No further lookups.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/+searchname\/...<\/code><\/td><td>Run named search <code>+searchname<\/code> with request arguments and return results.<\/td><\/tr><tr><td><code>get<\/code><\/td><td><code>\/<\/code><\/td><td>Run search from payload\/query arguments using the default search handling. No further lookups.<\/td><\/tr><\/tbody><\/table>\n<p><code>\/+name<\/code> marks a variable path segment. A trailing <code>\/...<\/code> means extra path segments are accepted for further lookups.<\/p>\n<h2>HTTP API example<\/h2>\n<p>The following request finds events, orders them by their start date, and returns the title, summary, start date, and end\ndate for the first 20 results:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-shell\">curl --get &#39;https:\/\/example.com\/api\/model\/search\/get\/paged&#39; \\\n  --header &#39;Accept: application\/json&#39; \\\n  --data-urlencode &#39;cat=event&#39; \\\n  --data-urlencode &#39;sort=pivot.date_start&#39; \\\n  --data-urlencode &#39;page=1&#39; \\\n  --data-urlencode &#39;pagelen=20&#39; \\\n  --data-urlencode &#39;options.properties=title,summary,date_start,date_end&#39;\n<\/code><\/pre>\n<p>The <code>options.properties<\/code> argument expands every result id into a resource property map. The <code>id<\/code> property is always\nincluded. Without this option, the <code>result<\/code> array contains resource ids. An abbreviated response is:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-json\">{\n  &quot;result&quot;: [\n    {\n      &quot;id&quot;: 123,\n      &quot;title&quot;: {\n        &quot;_type&quot;: &quot;trans&quot;,\n        &quot;tr&quot;: { &quot;en&quot;: &quot;Open Studio&quot; }\n      },\n      &quot;summary&quot;: {\n        &quot;_type&quot;: &quot;trans&quot;,\n        &quot;tr&quot;: { &quot;en&quot;: &quot;An afternoon with local artists.&quot; }\n      },\n      &quot;date_start&quot;: &quot;2026-09-12T13:00:00Z&quot;,\n      &quot;date_end&quot;: &quot;2026-09-12T17:00:00Z&quot;\n    }\n  ]\n}\n<\/code><\/pre>\n<p>The dates are returned as ISO 8601 UTC values. On multilingual sites, translated properties such as <code>title<\/code> and\n<code>summary<\/code> are returned as translation objects. Add <code>unfinished=true<\/code> to restrict the results to ongoing and future\nevents.<\/p>","slug":"search","is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"ac67677bc860dbec2668fa872a4f3b2bb5d2109d21d97d81e6c7f4031bcb727c","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":322,"is_a":["meta","category"],"name":"model","title":"Models","uri":"https:\/\/test.zotonic.com\/id\/322"},"doc_source_path":"apps\/zotonic_core\/src\/models\/m_search.erl","publication_start":"2023-06-24T08:17:55Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_core\/src\/models\/m_search.erl","pivot_location_lng":null,"doc_source_kind":"model","name":"doc_model_model_search","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-05-30T05:47:39Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_core","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"85498256abd162b9bc082d43a90c995844fd4408\n","erlang_module":"m_search","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-09-29T14:40:27Z","title_slug":"search"},"uri":"https:\/\/zotonic.com\/id\/1844","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1844"}},"status":"ok"}