z_search (zotonic_core v1.0.0-rc.10)
Link to this section Summary
Functions
Map a map with (binary) search options to a search option list.
Change a search props list to a map with binary keys.
Given a query as proplist or map, return all results.
Inject the ACL checks in the SQL query.
search(Search, Context)
deprecated
Search with the question and return the results
search(Search, MaxRows, Context)
deprecated
Perform the named search and its arguments
Perform a named search with arguments.
Perform a named search with arguments.
search_pager(Search, Page, Context)
deprecated
Search items and handle the paging. Uses the default page length.
Search items and handle the paging. This fetches extra rows beyond the requested rows to ensure that the pager has the information for the "next page" options. The number of extra rows depends on the current page, more for page 1, less for later pages.
Handle a return value from a search function. This can be an intermediate SQL statement that still needs to be augmented with extra ACL checks.
Link to this section Types
Link to this type
search_offset/0
-type search_offset() :: Limit :: pos_integer() | {Offset :: pos_integer(), Limit :: pos_integer()}.
Link to this type
search_options/0
-type search_options() :: #{properties => [binary()] | boolean()}.
Link to this type
search_query/0
-type search_query() :: {atom(), list()} | {binary(), map() | undefined}.
Link to this section Functions
Link to this function
concat_sql_query(Search_sql, Limit1)
Link to this function
map_to_options(Map)
-spec map_to_options(map()) -> search_options().
Link to this function
props_to_map(Props)
-spec props_to_map(proplists:proplist() | map()) -> #{binary() => term()}.
Link to this function
query_(Args, Context)
-spec query_(proplists:proplist() | map(), z:context()) -> [m_rsc:resource_id()].
Link to this function
reformat_sql_query(Search_sql, Context)
-spec reformat_sql_query(#search_sql{}, z:context()) -> #search_sql{}.
Link to this function
search(Search, Context)
This function is deprecated. use search/5.
-spec search({atom() | binary(), proplists:proplist() | map()}, z:context()) -> #search_result{}.
Link to this function
search(Search, MaxRows, Context)
This function is deprecated. use search/5.
-spec search(search_query(), search_offset() | undefined, z:context()) -> #search_result{}.
Link to this function
search(Name, Args, Page, PageLen, Context)
-spec search(Name, Args, Page, PageLen, Context) -> Result when Name :: binary(), Args :: map() | proplists:proplist() | undefined, Page :: pos_integer(), PageLen :: pos_integer(), Context :: z:context(), Result :: #search_result{}.
Link to this function
search(Name, Args, Page, PageLen, Options, Context)
-spec search(Name, Args, Page, PageLen, Options, Context) -> Result when Name :: binary(), Args :: map() | proplists:proplist() | undefined, Page :: pos_integer(), PageLen :: pos_integer(), Options :: map(), Context :: z:context(), Result :: #search_result{}.
Link to this function
search_pager(Search, Page, Context)
This function is deprecated. use search/5.
-spec search_pager(search_query(), Page :: pos_integer(), z:context()) -> #search_result{}.
Link to this function
search_pager(Search, Page, PageLen, Context)
-spec search_pager(search_query(), Page :: pos_integer(), PageLen :: pos_integer(), z:context()) -> #search_result{}.
Link to this function
search_result(Result, Limit, Context)
-spec search_result(Result, search_offset(), Context) -> #search_result{} when Result :: list() | #search_result{} | #search_sql{}, Context :: z:context().