Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
SearchApi Class Reference

Public Member Functions

 getRepositoryApi ()
 __construct ($searchUrl=null, $autosuggestUrl=null)
 search ($phrase, $params=array(), $start=null, $count=null)

Public Attributes

 $searchUrl
 $autosuggestUrl

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

Definition at line 11 of file SearchApi.php.

Constructor & Destructor Documentation

SearchApi::__construct (   $searchUrl = null,
  $autosuggestUrl = null 
)

Counstructor

Returns
void

Definition at line 59 of file SearchApi.php.

References $autosuggestUrl, and $searchUrl.

{
$this->searchUrl = $searchUrl;
$this->autosuggestUrl = $autosuggestUrl;
}

Member Function Documentation

SearchApi::getRepositoryApi ( )

Internal getter for repository api. It used to allows overriding of RepositoryApi properties by SearchApi properties

RepositoryApi

Definition at line 35 of file SearchApi.php.

References $autosuggestUrl, and $searchUrl.

{
if(!$this->_repositoryApi) {
if(!empty($this->searchUrl) || !empty($this->autosuggestUrl)) {
$repositoryApi = clone Yii::app()->repositoryApi;
if(!empty($this->searchUrl)){
$repositoryApi->search = $this->searchUrl;
}
if(!empty($this->autosuggestUrl)){
$repositoryApi->autosuggest = $this->autosuggestUrl;
}
$this->_repositoryApi = $repositoryApi;
} else {
$this->_repositoryApi = Yii::app()->repositoryApi;
}
}
return $this->_repositoryApi;
}
SearchApi::search (   $phrase,
  $params = array(),
  $start = null,
  $count = null 
)

method for search

Parameters
string$phrasetext to find
bool$usePersonalisationdefines if personalization
Returns
array

Definition at line 74 of file SearchApi.php.

{
if (!$this->_checkPhrase($phrase)) {
return false;
}
$whereToSearch = isset($params['whereToSearch']) ? $params['whereToSearch'] : Yii::app()->getModule('search')->whereToSearch['default'];
$mimetype = isset($params['mimetype']) ? $params['mimetype'] : Yii::app()->getModule('search')->mimetype['default'];
$searchType = isset($params['searchType']) ? $params['searchType'] : Yii::app()->getModule('search')->searchType['default'];
$urlLimiter = isset($params['urlLimiter']) ? $params['urlLimiter'] : Yii::app()->getModule('search')->urlLimiter['default'];
$enableSearchOperators = isset($params['enableSearchOperators']) ? $params['enableSearchOperators'] : Yii::app()->getModule('search')->searchType['enableSearchOperators'];
$data = array(
'results' => array(),
'metaresolvable' => array()
);
$data = $this->_preformSearch($phrase, $whereToSearch, $mimetype, $searchType, $urlLimiter, $start, $count, $enableSearchOperators);
if($data['status'] != 'ok'){
return false;
}
unset($data['status']);
$meta = $data['10001']['attributes'];
unset($data['10001']);
return array(
'meta' => $meta,
'results' => $data
);
}

Member Data Documentation

SearchApi::$autosuggestUrl

Overrided autosuggest url

string

Definition at line 25 of file SearchApi.php.

Referenced by __construct(), and getRepositoryApi().

SearchApi::$searchUrl

Overrided search url

string

Definition at line 18 of file SearchApi.php.

Referenced by __construct(), and getRepositoryApi().


The documentation for this class was generated from the following file: