forked from friendica/friendica-directory
Add page size parameter to search
- Update API call documentation
This commit is contained in:
parent
72d5e68c96
commit
959f526cb4
|
@ -11,14 +11,16 @@ Redirects to the base URL of a random server with open registration policy and a
|
||||||
## Search
|
## Search
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /search[/account_type]?q=...
|
GET /search[/account_type]?q=...[&page=...][&limit=...]
|
||||||
Accept: application/json
|
Accept: application/json
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameters:
|
URI Parameter:
|
||||||
|
- `account_type` (optional): An arbitrary account type string. Expected values are `all`, `people`, `news`, `organization` and `forum`. Default is `all`.
|
||||||
|
Query parameters:
|
||||||
- `q`: The search query.
|
- `q`: The search query.
|
||||||
- `account_type` (optional): An arbitrary account type string. Currently supported are `all`, `people` and `forum`. Default is `all`.
|
|
||||||
- `page` (optional): The page number, default is 1.
|
- `page` (optional): The page number, default is 1.
|
||||||
|
- `limit` (optional): The page size, default is 20, max is 100.
|
||||||
|
|
||||||
Returns a JSON structure containing a paginated list profiles matching the search query and the optional account type.
|
Returns a JSON structure containing a paginated list profiles matching the search query and the optional account type.
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,9 @@ class Search
|
||||||
|
|
||||||
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
|
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
|
||||||
{
|
{
|
||||||
$pager = new Pager($this->l10n, $request, 20);
|
$limit = min(100, filter_input(INPUT_GET, 'limit', FILTER_SANITIZE_NUMBER_INT) ?: 20);
|
||||||
|
|
||||||
|
$pager = new Pager($this->l10n, $request, $limit);
|
||||||
|
|
||||||
$originalQuery = $query = filter_input(INPUT_GET, 'q');
|
$originalQuery = $query = filter_input(INPUT_GET, 'q');
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,9 @@ class Search extends BaseController
|
||||||
|
|
||||||
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): array
|
public function render(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): array
|
||||||
{
|
{
|
||||||
$pager = new Pager($this->l10n, $request, 20);
|
$limit = min(100, filter_input(INPUT_GET, 'limit', FILTER_SANITIZE_NUMBER_INT) ?: 20);
|
||||||
|
|
||||||
|
$pager = new Pager($this->l10n, $request, $limit);
|
||||||
|
|
||||||
$originalQuery = $query = $request->getParam('q', '');
|
$originalQuery = $query = $request->getParam('q', '');
|
||||||
$field = $request->getParam('field', '');
|
$field = $request->getParam('field', '');
|
||||||
|
|
Loading…
Reference in a new issue