| Next revision | Previous revision |
| scriptlog:lib:controller:searchapicontroller [2026/09/26 09:09] – admin admin | scriptlog:lib:controller:searchapicontroller [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Controller Class | | | ''@category'' | Controller Class | |
| | ''@author'' | Blogware Team | | | ''@author'' | Blogware Team | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| |
| ^ Relation ^ Type ^ Meaning ^ | ^ Relation ^ Type ^ Meaning ^ |
| | extends | [[scriptlog:lib:controller:apicontroller|''ApiController'']] | parent class/interface | | | extends | [[scriptlog:lib:controller:apicontroller|''ApiController'']] | parent class/interface | |
| |
| ======= Constants (0) ======= | ======= Constants (0) ======= |
| //None.// | //None.// |
| |
| ======= Properties (0) ======= | ======= Properties (2) ======= |
| |
| //None declared.// | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | | ''private'' | ''(untyped)'' | ''$searchFinder'' | | 31 | |
| | | ''private'' | ''(untyped)'' | ''$hateoas'' | | 36 | |
| |
| ======= Methods (9) ======= | ======= Methods (9) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Constructor | 41 | | | public | ''__construct()'' | Constructor | 41 | |
| | public | ''index()'' | Search posts and pages (public endpoint) | 61 | | | public | ''index()'' | Search posts and pages (public endpoint) | 61 | |
| | private | ''checkRateLimit()'' | Check rate limit for search endpoint. | 143 | | | private | ''checkRateLimit()'' | Check rate limit for search endpoint. | 143 | |
| | public | ''posts()'' | Search posts only | 163 | | | public | ''posts()'' | Search posts only | 163 | |
| | public | ''pages()'' | Search pages only | 177 | | | public | ''pages()'' | Search pages only | 177 | |
| | private | ''buildResponseData()'' | Build the search API response payload. | 197 | | | private | ''buildResponseData()'' | Build the search API response payload. | 197 | |
| | private | ''transformResults()'' | Transform search results for API response | 228 | | | private | ''transformResults()'' | Transform search results for API response | 228 | |
| | private | ''generateExcerpt()'' | Generate excerpt from content | 261 | | | private | ''generateExcerpt()'' | Generate excerpt from content | 261 | |
| | private | ''getContentUrl()'' | Get content URL based on type | 293 | | | private | ''getContentUrl()'' | Get content URL based on type | 293 | |
| |
| |
| GET /api/v1/search/pages?q=keyword | GET /api/v1/search/pages?q=keyword |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$_params'' | ''(untyped)'' | ''[]'' | //none// | | | ''$_params'' | ''(untyped)'' | ''[]'' | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| GET /api/v1/search/posts?q=keyword | GET /api/v1/search/posts?q=keyword |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | //none// | | | ''$params'' | ''(untyped)'' | ''[]'' | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| GET /api/v1/search/pages?q=keyword | GET /api/v1/search/pages?q=keyword |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | ''[]'' | //none// | | | ''$params'' | ''(untyped)'' | ''[]'' | //none// | |
| |
| **Returns:** ''(none declared)'' — void | **Returns:** ''(none declared)'' — void |
| the result count without reaching into pagination.total_items. | the result count without reaching into pagination.total_items. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$results'' | ''(untyped)'' | //required// | Raw SearchFinder result (page, perPage, totalRows) | | | ''$results'' | ''(untyped)'' | //required// | Raw SearchFinder result (page, perPage, totalRows) | |
| | ''$transformedResults'' | ''(untyped)'' | //required// | Normalized results for the API consumer | | | ''$transformedResults'' | ''(untyped)'' | //required// | Normalized results for the API consumer | |
| | ''$type'' | ''(untyped)'' | //required// | Requested search scope (all|posts|pages) | | | ''$type'' | ''(untyped)'' | //required// | Requested search scope (all|posts|pages) | |
| | ''$keyword'' | ''(untyped)'' | //required// | Sanitized search keyword | | | ''$keyword'' | ''(untyped)'' | //required// | Sanitized search keyword | |
| | ''$totalPages'' | ''(untyped)'' | //required// | Total number of result pages | | | ''$totalPages'' | ''(untyped)'' | //required// | Total number of result pages | |
| | ''$hateoasLinks'' | ''(untyped)'' | //required// | Optional HATEOAS pagination links | | | ''$hateoasLinks'' | ''(untyped)'' | //required// | Optional HATEOAS pagination links | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Transform search results for API response | Transform search results for API response |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$results'' | ''(untyped)'' | //required// | //none// | | | ''$results'' | ''(untyped)'' | //required// | //none// | |
| | ''$_type'' | ''(untyped)'' | //required// | //none// | | | ''$_type'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| truncated excerpt reads cleanly. | truncated excerpt reads cleanly. |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$content'' | ''(untyped)'' | //required// | //none// | | | ''$content'' | ''(untyped)'' | //required// | //none// | |
| | ''$length'' | ''(untyped)'' | ''150'' | //none// | | | ''$length'' | ''(untyped)'' | ''150'' | //none// | |
| |
| **Returns:** ''(none declared)'' — string | **Returns:** ''(none declared)'' — string |
| Get content URL based on type | Get content URL based on type |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$id'' | ''(untyped)'' | //required// | //none// | | | ''$id'' | ''(untyped)'' | //required// | //none// | |
| | ''$slug'' | ''(untyped)'' | //required// | //none// | | | ''$slug'' | ''(untyped)'' | //required// | //none// | |
| | ''$type'' | ''(untyped)'' | //required// | //none// | | | ''$type'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — string | **Returns:** ''(none declared)'' — string |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''ApiController'' | [[scriptlog:lib:controller:apicontroller|''Scriptlog\Controller\ApiController'']] | | | ''ApiController'' | [[scriptlog:lib:controller:apicontroller|''Scriptlog\Controller\ApiController'']] | |
| | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | | | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | |
| | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | | | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | |
| | ''SearchFinder'' | [[scriptlog:lib:core:searchfinder|''Scriptlog\Core\SearchFinder'']] | | | ''SearchFinder'' | [[scriptlog:lib:core:searchfinder|''Scriptlog\Core\SearchFinder'']] | |
| |
| |