Nextcloud PHP API (stable18)

IFullTextSearchPlatform

Interface IFullTextSearchPlatform

This interface must be use when creating a Search Platform for FullTextSearch.

A Search Platform is an extension to the FullTextSearch that will act as a a gateway between FullTextSearch and a search server (ie. ElasticSearch, Solr, ...)

Multiple Search Platform can exist at the same time in Nextcloud, however only one Search Platform will be used by FullTextSearch. Administrator must select at least one Search Platform to be used by FullTextSearch in the admin settings page.

The content provided by FullTextSearch comes in chunk from multiple Content Provider. Each chunk is identified by the ID of the Content Provider, and the ID of the document.

To oversimplify the mechanism:

  • When indexing, FullTextSearch will send providerId, documentId, content.
  • When searching within the content of a Content Provider, identified by its providerId, FullTextSearch expect documentId as result.

The Search Platform ia a PHP class that implement this interface and is defined in appinfo/info.xml of the app that contains that class:

<fulltextsearch> <platform>OCA\YourApp\YourSearchPlatform</platform> </fulltextsearch>

Multiple Search Platform can be defined in a single app.

Tags
since
15.0.0

Table of Contents

deleteIndexes()  : mixed
Deleting some IIndex, sent in an array
getConfiguration()  : array
should returns the current configuration of the Search Platform.
getDocument()  : IIndexDocument
Return a document based on its Id and the Provider.
getId()  : string
Must returns a unique Id used to identify the Search Platform.
getName()  : string
Must returns a descriptive name of the Search Platform.
indexDocument()  : IIndex
Indexing a document.
initializeIndex()  : mixed
Called before an index is initiated.
loadPlatform()  : mixed
Called when FullTextSearch is loading your Search Platform.
resetIndex()  : mixed
Reset the indexes for a specific providerId.
searchRequest()  : mixed
Searching documents, ISearchResult should be updated with the result of the search.
setRunner()  : mixed
Set the wrapper of the currently executed process.
testPlatform()  : bool
Called to check that your Search Platform is correctly configured and that This is also the right place to check that the Search Service is available.

Methods

deleteIndexes()

Deleting some IIndex, sent in an array

public deleteIndexes(\OCP\FullTextSearch\Model\IIndex[] $indexes) : mixed
Parameters
$indexes : \OCP\FullTextSearch\Model\IIndex[]
Tags
see
IIndex
since
15.0.0
Return values
mixed

getConfiguration()

should returns the current configuration of the Search Platform.

public getConfiguration() : array

This is used to display the configuration when using the ./occ fulltextsearch:check command line.

Tags
since
15.0.0
Return values
array

getDocument()

Return a document based on its Id and the Provider.

public getDocument(string $providerId, string $documentId) : IIndexDocument

This is used when an admin execute ./occ fulltextsearch:document:platform

Parameters
$providerId : string
$documentId : string
Tags
since
15.0.0
Return values
IIndexDocument

getId()

Must returns a unique Id used to identify the Search Platform.

public getId() : string

Id must contains only alphanumeric chars, with no space.

Tags
since
15.0.0
Return values
string

getName()

Must returns a descriptive name of the Search Platform.

public getName() : string

This is used mainly in the admin settings page to display the list of available Search Platform

Tags
since
15.0.0
Return values
string

initializeIndex()

Called before an index is initiated.

public initializeIndex() : mixed

Best place to initiate some stuff on the Search Server (mapping, ...)

Tags
since
15.0.0
Return values
mixed

loadPlatform()

Called when FullTextSearch is loading your Search Platform.

public loadPlatform() : mixed
Tags
since
15.0.0
Return values
mixed

resetIndex()

Reset the indexes for a specific providerId.

public resetIndex(string $providerId) : mixed

$providerId can be 'all' if it is a global reset.

Parameters
$providerId : string
Tags
since
15.0.0
Return values
mixed

setRunner()

Set the wrapper of the currently executed process.

public setRunner(IRunner $runner) : mixed

Because the index process can be long and heavy, and because errors can be encountered during the process, the IRunner is a wrapper that allow the Search Platform to communicate with the process initiated by FullTextSearch.

The IRunner is coming with some methods so the Search Platform can returns important information and errors to be displayed to the admin.

Parameters
$runner : IRunner
Tags
since
15.0.0
Return values
mixed

testPlatform()

Called to check that your Search Platform is correctly configured and that This is also the right place to check that the Search Service is available.

public testPlatform() : bool
Tags
since
15.0.0
Return values
bool

Search results