\Ceo\Modules\Frontend\ControllersSearchController

Search controller

Search accepts the following parameters via GET:

  • keywords - search keywords
  • order - search sort, default is published time, must be a valid property
  • direction - sort direction, can be asc or desc, default is newest first (desc)
  • tag - comma separated list of inclusive tags to search
  • author - comma separated list of inclusive authors to search
  • title - items title, headline, filename
  • begin - published begin time, in the form of YYYYMMDD
  • end - published end time, in the form of YYYYMMDD
  • type - content type, article, post, media - by default searches ALL types

Search can also work in compatibility mode if a=1 or q= are present in the query string. In that case, the following substitutions are made:

IF a=1 is present:

  • keywords -> s
  • order -> d
  • direction -> o
  • tag -> tg
  • author -> au
  • title -> ti
  • type -> ty
  • ts_* -> begin
  • te_* -> end

IF q=string is present:

  • keywords -> q
  • order -> "published_at"
  • direction -> "desc"
  • tag -> NULL
  • author -> NULL
  • title -> NULL
  • type -> NULL
  • ts_* -> NULL
  • te_* -> NULL

Summary

Methods
Properties
Constants
initialize()
indexAction()
No public properties found
No constants found
enableCompatibilityView()
terminateWithView()
getHttpCodeDescription()
getRequestSegments()
getJsonData()
buildItemCollection()
buildPagination()
No protected properties found
N/A
handleSearch()
No private properties found
N/A

Methods

initialize()

initialize() 

Initialize response headers

indexAction()

indexAction() 

Search action, by URLs in the form of:

  • search

Returns the following items to the view:

Looks for templates in the following order:

  • gryphon/search/advanced.tpl - Compatibility mode
  • search/index.twig

Search items implement the Searchable Trait

enableCompatibilityView()

enableCompatibilityView(string  $view) : boolean

Enables path to Gryphon compatible view, if the view exists AND enableCompatibility is on.

NOTE: This will mutate the internal view.

Parameters

string $view

Returns

boolean

terminateWithView()

terminateWithView(string  $view, array  $params = array(), array  $headers = array()) 

Terminate the action with a view partial. Will dump output directly to browser, but return the action allowing process to continue.

Parameters

string $view

path

array $params

view params

array $headers

optional headers

getHttpCodeDescription()

getHttpCodeDescription(  $code) 

Parameters

$code

getRequestSegments()

getRequestSegments(  $i = null) : mixed

Return rewrite url segments

Parameters

$i

Returns

mixed —

either all segments as array, or single segment

getJsonData()

getJsonData() : array

Fetch POSTed/PUTed json data

Returns

array

buildItemCollection()

buildItemCollection(array  $matches) : array

Build collection of items. Casts search results as proper model types.

If model type cannot be determined, will cast as \Ceo\Search\Result type which implements the \Ceo\Traits\Searchable trait.

Parameters

array $matches

Returns

array

buildPagination()

buildPagination(  $props,   $searchParams) : \Ceo\Pagination\Pagination

Build the pagination object

Parameters

$props
$searchParams

Returns

\Ceo\Pagination\Pagination

handleSearch()

handleSearch(  $props = array()) : array

Handle search direct on CEO search service

Parameters

$props

Returns

array