Contentserv PHP API

CSOpenSearch
in package

Tags

Table of Contents

BOOKMARK_OPEN_SEARCH_AREA  = 1
CACHEFOLDER_OPENSEARCH  = 'opensearch'
CACHEFOLDER_OPENSEARCH_ITEM  = 'opensearchitem'
CACHEFOLDER_OPENSEARCH_PREVIEW  = 'opensearchpreview'
OPEN_SEARCH_AREA  = 0
SEARCH_AREA_BOOKMARK_PLUGIN  = 'csbookmarkopensearcharea'
SEARCH_SORT_BY_CREATIONDATE  = 'CreationDate'
SEARCH_SORT_BY_LABEL  = 'Label'
SEARCH_SORT_BY_LASTCHANGE  = 'LastChange'
activateCache()  : void
Activates the cache for the OpenSearch again.
copyFromTemplate()  : void
Copies data form given template record to the target object.
createDefaultSearchAreas()  : void
Utility method to create all search areas if none are existing
createSearchRequest()  : CSOpenSearchRequest
Creates a new standard search request object from a given search phrase and language SearchRequests are then passed to the search plugins
createSearchWindow()  : CSOpenSearchWindow
Creates a new Search Window for a given REST service key All search requests and methods are called through this REST service key. This allows to create multiple search URLs that can be configured differently.
createShare()  : CSOpenShare
Creates a new OpenSearchArea with an OpenKey
createShareUrl()  : string
Creates an external URL which will create a new Share by calling this URL
createShareWindow()  : CSOpenShareWindow
Creates a new Share Window for a given REST service key All search requests and methods are called through this REST service key. This allows to create multiple search URLs that can be configured differently.
deactivateCache()  : void
Deactivates the cache in the following OpenSearch method calls.
deleteCache()  : bool
Delete all cache files from the hard disk related to opensearch
deleteCacheForOpenKey()  : mixed
Deletes a cache snippet from the hard disk for a given open search area key.
filterSearchResults()  : void
This method filters the search results for all responses and adds only the ids for those really needed as items in response.
getAreas()  : array<string|int, mixed>
Retrieves the available search areas
getAreasAsObjects()  : array<string|int, CSOpenSearchArea>
Returns an array of CSOpenSearchArea(s) as objects.
getAvailableLanguages()  : array<string|int, CSLanguage>
Collects the available languages
getAvailableOpenShares()  : array<string|int, CSOpenSearchArea>
Returns the possible OpenSearch Areas as array
getAvailableOpenSharesForItemClass()  : array<string|int, CSOpenSearchArea>
Returns the possible Open search shares as array for a given item class.
getAvailableSearchAreas()  : array<string|int, CSOpenSearchArea>
Returns the possible OpenSearch Areas as array
getAvailableSearchAreasForItemClass()  : array<string|int, CSOpenSearchArea>
Returns the possible OpenSearch Areas as array for a given item class.
getAvailableSearchAreasForLabel()  : array<string|int, CSOpenSearchArea>
Returns the possible OpenSearch Areas as array
getAvailableSearchAreaTabs()  : array<string|int, CSOpenSearchArea>
Returns the available search areas for tab according to Show As Tab option and useraccess.
getAvailableSearchAreaTemplateNames()  : array<string|int, CSOpenSearchArea>
Returns the possible open search area template names.
getAvailableSearchAreaTemplates()  : array<string|int, CSOpenSearchArea>
Returns the possible open search area templates as array
getAvailableSearchAreaTemplatesForItemClass()  : array<string|int, CSOpenSearchArea>
Returns the possible OpenSearch Areas as array for a given item class.
getAvailableSearchAreaTiles()  : array<string|int, CSOpenSearchArea>
Returns the available search areas for tile according to Show As Tile option and useraccess.
getAvailableSearchAreaTypes()  : array<string|int, mixed>
Fetches the list of all the available search area types
getEverywhereSearchAreaObjects()  : array<string|int, mixed>
This method returns the everywhere opensearch area available objects types
getFacetSearchableStandardAttributeIds()  : array<string|int, mixed>
Fetches the list of Attribute IDs of Standard attributes that are activated as facet for given item type
getFolderForMyFiles()  : int
Returns the Id of the "users" folder in mam
getLandingPageLogo()  : bool|string
Returns the ImageServer URL to the defined landing page logo from the options otherwise FALSE.
getMaxLimitForResults()  : int
Returns the maximum limit for the objects in the list of Open Search Results.
getModuleBaseDirectory()  : string
Returns the base path of the OpenSearch module.
getMyFilesTabPosition()  : int
This method returns the position at which the MyFiles tab is going to be introduced. Added to cover the usecase when the database column cease to exist
getOpenSearchPlugins()  : array<string|int, CSOpenSearchPlugin>
Delivers a list of {@see CSOpenSearchPlugin} plugins that may adapt the OpenSearch experience where required
getOpenSearchWindowPlugins()  : array<string|int, CSOpenSearchWindowPlugin>
Delivers a list of {@see CSOpenSearchWindowPlugin} plugins that may adapt the OpenSearch UI where required
getOpenShare()  : CSOpenShare
Retrieves an open share
getOpenShareByKey()  : null|CSOpenShare
Gets an CSOpenSearchArea for an OpenKey
getPreviewHtml()  : string
Defines the Html that should be displayed as preview of an item
getProductIcon()  : string
Returns one of the product icons
getRecordClassIdForRecordType()  : int
Fetches the ID of Record Class to be used while inserting an Open Search Area Mapping entry
getResultsPerPage()  : int
Defines the default number of results per search page for each plugin
getSearchArea()  : CSOpenSearchArea
Retrieves a search area
getSearchAreaPluginNames()  : array<string|int, string>
Collects the names of available search area plugins
getSearchAreaPluginNamesForType()  : array<string|int, mixed>
Returns the search area plugin names for a given search area type.
getSearchAreaPlugins()  : array<string|int, CSOpenSearchAreaPlugin>
Collects all available Search Area Plugins
getSearchAreaPluginsForType()  : array<string|int, CSOpenSearchAreaPlugin>
Returns the search area plugins for a given search area type.
getSearchAreas()  : array<string|int, CSOpenSearchArea>
Returns all existing Search Areas without any access filter
getSearchAreaTemplates()  : array<string|int, CSOpenSearchArea>
Returns all existing search area templates.
getSearchFilter()  : string
Returns an defined search filter for a specific open search type
getSearchMode()  : int
Fetches the search mode for Open Search
getSortByFields()  : array<string|int, mixed>
Returns an array of available sortby fields for collections.
getSortOrderTypes()  : array<string|int, mixed>
Returns an array of available sort order types.
mayUseFullTextSearch()  : bool
Tests if the full text search is available to use in open search
resolvePluginForRecord()  : CSItemSearchAreaPlugin
Resolves plugin for the given record.
search()  : CSOpenSearchResponse|mixed
Triggers the actual search
shouldAllowCaching()  : bool
Checks whether the caching in the OpenSearch is deactivated or activated.
shouldShowSearchAreaAsTab()  : bool
Returns true to show search areas as tab else false.
shouldShowSearchAreaAsTile()  : bool
Returns true to show search areas as tile else false.

Constants

BOOKMARK_OPEN_SEARCH_AREA

public mixed BOOKMARK_OPEN_SEARCH_AREA = 1
Tags

CACHEFOLDER_OPENSEARCH

public mixed CACHEFOLDER_OPENSEARCH = 'opensearch'
Tags

CACHEFOLDER_OPENSEARCH_ITEM

public mixed CACHEFOLDER_OPENSEARCH_ITEM = 'opensearchitem'
Tags

CACHEFOLDER_OPENSEARCH_PREVIEW

public mixed CACHEFOLDER_OPENSEARCH_PREVIEW = 'opensearchpreview'
Tags

SEARCH_AREA_BOOKMARK_PLUGIN

public mixed SEARCH_AREA_BOOKMARK_PLUGIN = 'csbookmarkopensearcharea'
Tags

SEARCH_SORT_BY_CREATIONDATE

public mixed SEARCH_SORT_BY_CREATIONDATE = 'CreationDate'
Tags

SEARCH_SORT_BY_LABEL

public mixed SEARCH_SORT_BY_LABEL = 'Label'
Tags

SEARCH_SORT_BY_LASTCHANGE

public mixed SEARCH_SORT_BY_LASTCHANGE = 'LastChange'
Tags

Methods

activateCache()

Activates the cache for the OpenSearch again.

public static activateCache() : void
Tags
Return values
void

copyFromTemplate()

Copies data form given template record to the target object.

public static copyFromTemplate(int|OpenSearchArea $iTemplateIdOrRecordSource, Record|CSOpenSearchArea $oTargetObject) : void
Parameters
$iTemplateIdOrRecordSource : int|OpenSearchArea
$oTargetObject : Record|CSOpenSearchArea
Tags
Return values
void

createDefaultSearchAreas()

Utility method to create all search areas if none are existing

public static createDefaultSearchAreas() : void
Tags
access

public

Return values
void

createSearchRequest()

Creates a new standard search request object from a given search phrase and language SearchRequests are then passed to the search plugins

public static createSearchRequest(string $sSearch, int|string $mLanguage) : CSOpenSearchRequest
Parameters
$sSearch : string

The search phrase

$mLanguage : int|string

The language ID or short name

Tags
access

public

Return values
CSOpenSearchRequest

createSearchWindow()

Creates a new Search Window for a given REST service key All search requests and methods are called through this REST service key. This allows to create multiple search URLs that can be configured differently.

public static createSearchWindow(string $sServiceKey) : CSOpenSearchWindow
Parameters
$sServiceKey : string

The service key which must exist of course

Tags
access

public

Return values
CSOpenSearchWindow

The window object

createShare()

Creates a new OpenSearchArea with an OpenKey

public static createShare([int $iOpenSearchAreaTemplateId = null ][, mixed $sLabel = '' ][, mixed $sIds = '' ]) : CSOpenShare
Parameters
$iOpenSearchAreaTemplateId : int = null

the ID of the search area

$sLabel : mixed = ''
$sIds : mixed = ''
Tags
Return values
CSOpenShare

createShareUrl()

Creates an external URL which will create a new Share by calling this URL

public static createShareUrl(string $IDs, string $ClassName, string $Label) : string
Parameters
$IDs : string

comma separated ID list of records

$ClassName : string

name of the record class like Mamfile

$Label : string

name of the new share

Tags
Return values
string

the URL

createShareWindow()

Creates a new Share Window for a given REST service key All search requests and methods are called through this REST service key. This allows to create multiple search URLs that can be configured differently.

public static createShareWindow(string $sServiceKey) : CSOpenShareWindow
Parameters
$sServiceKey : string

The service key which must exist of course

Tags
access

public

Return values
CSOpenShareWindow

The window object

deactivateCache()

Deactivates the cache in the following OpenSearch method calls.

public static deactivateCache() : void
Tags
Return values
void

deleteCache()

Delete all cache files from the hard disk related to opensearch

public static deleteCache() : bool
Tags
Return values
bool

deleteCacheForOpenKey()

Deletes a cache snippet from the hard disk for a given open search area key.

public static deleteCacheForOpenKey(int $sOpenKey) : mixed
Parameters
$sOpenKey : int

The open key of the open search area.

Tags
Return values
mixed

getAreas()

Retrieves the available search areas

public static getAreas(CSOpenSearchRequest $oRequest) : array<string|int, mixed>
Parameters
$oRequest : CSOpenSearchRequest

The request

Tags
access

public

Return values
array<string|int, mixed>

Array with the available search areas of all search plugins (only labels).

getAvailableLanguages()

Collects the available languages

public static getAvailableLanguages() : array<string|int, CSLanguage>
Tags
access

public

Return values
array<string|int, CSLanguage>

Array with language objects

getAvailableOpenShares()

Returns the possible OpenSearch Areas as array

public static getAvailableOpenShares() : array<string|int, CSOpenSearchArea>
Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreaIDs as keys and CSOpenSearchArea as values

getAvailableOpenSharesForItemClass()

Returns the possible Open search shares as array for a given item class.

public static getAvailableOpenSharesForItemClass(string $sItemClass) : array<string|int, CSOpenSearchArea>
Parameters
$sItemClass : string

The Item class which should used for filtering the available open search areas.

Tags
Return values
array<string|int, CSOpenSearchArea>

getAvailableSearchAreas()

Returns the possible OpenSearch Areas as array

public static getAvailableSearchAreas([string $sAreaFilter = '' ][, bool $bAddOpenShares = false ][, mixed $sSortOrder = '' ]) : array<string|int, CSOpenSearchArea>
Parameters
$sAreaFilter : string = ''

A SQL Filter to match the desired database area object.

$bAddOpenShares : bool = false

Whether the open shares should be added or not.

$sSortOrder : mixed = ''
Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreaIDs as keys and CSOpenSearchArea as values

getAvailableSearchAreasForItemClass()

Returns the possible OpenSearch Areas as array for a given item class.

public static getAvailableSearchAreasForItemClass(string $sItemClass[, bool $bAddOpenShares = false ]) : array<string|int, CSOpenSearchArea>
Parameters
$sItemClass : string

The Item class which should used for filtering the available open search areas.

$bAddOpenShares : bool = false

Whether the open shares should be added or not.

Tags
Return values
array<string|int, CSOpenSearchArea>

getAvailableSearchAreasForLabel()

Returns the possible OpenSearch Areas as array

public static getAvailableSearchAreasForLabel(string $sLabel[, bool $bAddOpenShares = false ][, string $sAreaFilter = '(1=1)' ]) : array<string|int, CSOpenSearchArea>
Parameters
$sLabel : string

The label which should used for filtering the available open search areas.

$bAddOpenShares : bool = false

Whether the open shares should be added or not.

$sAreaFilter : string = '(1=1)'

A SQL Filter to match the defined area.

Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreaIDs as keys and CSOpenSearchArea as values

getAvailableSearchAreaTabs()

Returns the available search areas for tab according to Show As Tab option and useraccess.

public static getAvailableSearchAreaTabs([bool $bAddOpenShares = true ][, array<string|int, mixed> $aSortBy = array() ]) : array<string|int, CSOpenSearchArea>
Parameters
$bAddOpenShares : bool = true

TRUE if includes Open Shares otherwise FALSE

$aSortBy : array<string|int, mixed> = array()

Accepts sorting info info in the form of Key => Value pair.

Tags
Return values
array<string|int, CSOpenSearchArea>

List of Search areas which configured as Show As Tab.

getAvailableSearchAreaTemplateNames()

Returns the possible open search area template names.

public static getAvailableSearchAreaTemplateNames() : array<string|int, CSOpenSearchArea>
Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreaIDs as keys and CSOpenSearchArea labels as values

getAvailableSearchAreaTemplates()

Returns the possible open search area templates as array

public static getAvailableSearchAreaTemplates() : array<string|int, CSOpenSearchArea>
Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreaIDs as keys and CSOpenSearchArea as values

getAvailableSearchAreaTemplatesForItemClass()

Returns the possible OpenSearch Areas as array for a given item class.

public static getAvailableSearchAreaTemplatesForItemClass(string $sItemClass) : array<string|int, CSOpenSearchArea>
Parameters
$sItemClass : string

The Item class which should used for filtering the available open search areas.

Tags
Return values
array<string|int, CSOpenSearchArea>

getAvailableSearchAreaTiles()

Returns the available search areas for tile according to Show As Tile option and useraccess.

public static getAvailableSearchAreaTiles([bool $bAddOpenShares = true ][, array<string|int, mixed> $aSortBy = array() ]) : array<string|int, CSOpenSearchArea>
Parameters
$bAddOpenShares : bool = true

TRUE if includes Open Shares otherwise FALSE

$aSortBy : array<string|int, mixed> = array()

Accepts sorting info info in the form of Key => Value pair.

Tags
Return values
array<string|int, CSOpenSearchArea>

List of Search areas which configured as Show As Tile.

getAvailableSearchAreaTypes()

Fetches the list of all the available search area types

public static getAvailableSearchAreaTypes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getEverywhereSearchAreaObjects()

This method returns the everywhere opensearch area available objects types

public static getEverywhereSearchAreaObjects() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

array of string that returns

getFacetSearchableStandardAttributeIds()

Fetches the list of Attribute IDs of Standard attributes that are activated as facet for given item type

public static getFacetSearchableStandardAttributeIds(string $sItemType) : array<string|int, mixed>
Parameters
$sItemType : string

Item type for which the facet attributes are requested

Tags
Return values
array<string|int, mixed>

IDs of Standard attributes that are activated as facet for given item type

getFolderForMyFiles()

Returns the Id of the "users" folder in mam

public static getFolderForMyFiles([int|null $iUserId = null ]) : int
Parameters
$iUserId : int|null = null

The id of the current user

Tags
Return values
int

Returns the ImageServer URL to the defined landing page logo from the options otherwise FALSE.

public static getLandingPageLogo() : bool|string
Tags
Return values
bool|string

getMaxLimitForResults()

Returns the maximum limit for the objects in the list of Open Search Results.

public static getMaxLimitForResults() : int

Note: This limit is not effective on generation of facets.

Tags
Return values
int

getModuleBaseDirectory()

Returns the base path of the OpenSearch module.

public static getModuleBaseDirectory([string $sBaseType = null ]) : string
Parameters
$sBaseType : string = null

The type of link that shall be returned, see for details.

Tags
access

public

Return values
string

The location of the OpenSearch module in relation to the specified location base type.

getMyFilesTabPosition()

This method returns the position at which the MyFiles tab is going to be introduced. Added to cover the usecase when the database column cease to exist

public static getMyFilesTabPosition() : int
Tags
access

public

Return values
int

the position at which the MyFiles tab

getOpenSearchPlugins()

Delivers a list of {@see CSOpenSearchPlugin} plugins that may adapt the OpenSearch experience where required

public static getOpenSearchPlugins() : array<string|int, CSOpenSearchPlugin>
Tags
Return values
array<string|int, CSOpenSearchPlugin>

array with OpenSearch Plugins if available

getOpenSearchWindowPlugins()

Delivers a list of {@see CSOpenSearchWindowPlugin} plugins that may adapt the OpenSearch UI where required

public static getOpenSearchWindowPlugins() : array<string|int, CSOpenSearchWindowPlugin>
Tags
Return values
array<string|int, CSOpenSearchWindowPlugin>

array with OpenSearch Window Plugins if available

getOpenShare()

Retrieves an open share

public static getOpenShare(int|string|OpenShare $mIdentifier) : CSOpenShare
Parameters
$mIdentifier : int|string|OpenShare

Name, ID or OpenShare

Tags
access

public

Return values
CSOpenShare

getOpenShareByKey()

Gets an CSOpenSearchArea for an OpenKey

public static getOpenShareByKey(string $sOpenKey[, string $sAreaFilter = '(1=1)' ]) : null|CSOpenShare
Parameters
$sOpenKey : string

the OpenKey

$sAreaFilter : string = '(1=1)'

A SQL Filter to match the defined area.

Tags
Return values
null|CSOpenShare

The open share for the given key or null, if the open key does not exist.

getPreviewHtml()

Defines the Html that should be displayed as preview of an item

public static getPreviewHtml(int $iSearchAreaID, int $iObjectID, CSOpenSearchRequest $oRequest) : string
Parameters
$iSearchAreaID : int

The ID of the search area

$iObjectID : int

The ID that was provided with the addItem Method in the @see search method

$oRequest : CSOpenSearchRequest
Tags
access

public

Return values
string

HTML code that can be embedded via Ajax call in the search window

getProductIcon()

Returns one of the product icons

public static getProductIcon([string $type = 'opensearch' ]) : string
Parameters
$type : string = 'opensearch'
Tags
Return values
string

getRecordClassIdForRecordType()

Fetches the ID of Record Class to be used while inserting an Open Search Area Mapping entry

public static getRecordClassIdForRecordType(string $sRecordType) : int
Parameters
$sRecordType : string

Record Type

Tags
Return values
int

Record Type Class ID

getResultsPerPage()

Defines the default number of results per search page for each plugin

public static getResultsPerPage() : int
Tags
access

public

Return values
int

The number of results

getSearchArea()

Retrieves a search area

public static getSearchArea(int|string|OpenSearchArea $mIdentifier) : CSOpenSearchArea
Parameters
$mIdentifier : int|string|OpenSearchArea

Name, ID or OpenSearchArea

Tags
access

public

Return values
CSOpenSearchArea

getSearchAreaPluginNames()

Collects the names of available search area plugins

public static getSearchAreaPluginNames() : array<string|int, string>
Tags
access

public

Return values
array<string|int, string>

array with the search area plugin names

getSearchAreaPluginNamesForType()

Returns the search area plugin names for a given search area type.

public static getSearchAreaPluginNamesForType([int $iSearchAreaType = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA ]) : array<string|int, mixed>
Parameters
$iSearchAreaType : int = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA

The search area type.

Tags
Return values
array<string|int, mixed>

with thesearch area plugin names for a given search area type.

getSearchAreaPluginsForType()

Returns the search area plugins for a given search area type.

public static getSearchAreaPluginsForType([int $iSearchAreaType = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA ]) : array<string|int, CSOpenSearchAreaPlugin>

See constants "CSOpenSearchArea::TYPE_*"

Parameters
$iSearchAreaType : int = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA

The search area type.

Tags
Return values
array<string|int, CSOpenSearchAreaPlugin>

with the search area plugins for a given search area type.

getSearchAreas()

Returns all existing Search Areas without any access filter

public static getSearchAreas([string $sFilter = '1=1' ][, mixed $sSortOrder = '' ]) : array<string|int, CSOpenSearchArea>
Parameters
$sFilter : string = '1=1'

SQL filter condition

$sSortOrder : mixed = ''
Tags
access

public

Return values
array<string|int, CSOpenSearchArea>

Array with CSOpenSearchAreas

getSearchFilter()

Returns an defined search filter for a specific open search type

public static getSearchFilter([int $iSearchType = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA ]) : string
Parameters
$iSearchType : int = CSOpenSearchArea::TYPE_OPEN_SEARCH_AREA

The open search type.

Tags
see
CSOpenSearchArea

constants

Return values
string

with the defined search filter.

getSearchMode()

Fetches the search mode for Open Search

public static getSearchMode() : int
Tags
Return values
int

Standard Search Mode from constants of the family CS_SEARCH_GOOGLE_LIKE_*.

getSortByFields()

Returns an array of available sortby fields for collections.

public static getSortByFields() : array<string|int, mixed>

Available values are SEARCH_SORT*-constants, key is the SEARCH_SORT_* constant and value is the translated value.

Tags
access

public

Return values
array<string|int, mixed>

Available SortBy field values for collections.

getSortOrderTypes()

Returns an array of available sort order types.

public static getSortOrderTypes() : array<string|int, mixed>

As key the CS_SORT_* value and as value the translated value.

Tags
Return values
array<string|int, mixed>

mayUseFullTextSearch()

Tests if the full text search is available to use in open search

public static mayUseFullTextSearch() : bool
Tags
Return values
bool

TRUE if Full Text Search can be used in Open Search FALSE, Otherwise.

resolvePluginForRecord()

Resolves plugin for the given record.

public static resolvePluginForRecord(Record $oRecord) : CSItemSearchAreaPlugin
Parameters
$oRecord : Record

is the record object.

Tags
Return values
CSItemSearchAreaPlugin

available plugin for the given record.

shouldAllowCaching()

Checks whether the caching in the OpenSearch is deactivated or activated.

public static shouldAllowCaching() : bool
Tags
Return values
bool

shouldShowSearchAreaAsTab()

Returns true to show search areas as tab else false.

public static shouldShowSearchAreaAsTab() : bool
Tags
Return values
bool

true to show search areas as tab else false.

shouldShowSearchAreaAsTile()

Returns true to show search areas as tile else false.

public static shouldShowSearchAreaAsTile() : bool
Tags
Return values
bool

true to show search areas as tile else false.


        

Search results