Nextcloud PHP API (stable19)

ISearchResult

Interface ISearchResult

When a search request is initiated, FullTextSearch will create a SearchResult object, based on this interface, containing the SearchRequest and the targeted Content Provider.

The object will be passed to the Search Platform, which will proceed to the search and fill the SearchResult object with results.

Then, the object will be passed to the targeted Content Provider that will improve the Search Results with detailed informations.

Finally, the SearchResult is returned to the original search request.

Tags
since
15.0.0

Table of Contents

addAggregation()  : ISearchResult
Add an aggregation to the result.
addDocument()  : ISearchResult
Add an IIndexDocument as one of the result of the search request.
getAggregations()  : array
Get all aggregations.
getDocuments()  : \OCP\FullTextSearch\Model\IIndexDocument[]
Returns all result of the search request, in an array of IIndexDocument.
getProvider()  : IFullTextSearchProvider
Get the targeted Content Provider.
getRequest()  : ISearchRequest
Get the original SearchRequest.
setDocuments()  : ISearchResult
Set an array of IIndexDocument as the result of the search request.
setMaxScore()  : ISearchResult
Set the top score for the search request.
setRawResult()  : ISearchResult
Set the raw result of the request.
setTime()  : ISearchResult
Set the time spent by the request to perform the search.
setTimedOut()  : ISearchResult
Set to true if the request timed out.
setTotal()  : ISearchResult
Set the total number of results for the search request.

Methods

addAggregation()

Add an aggregation to the result.

public addAggregation(string $category, string $value, int $count) : ISearchResult
Parameters
$category : string
$value : string
$count : int
Tags
since
15.0.0
Return values
ISearchResult

getAggregations()

Get all aggregations.

public getAggregations(string $category) : array
Parameters
$category : string
Tags
since
15.0.0
Return values
array

getDocuments()

Returns all result of the search request, in an array of IIndexDocument.

public getDocuments() : \OCP\FullTextSearch\Model\IIndexDocument[]
Tags
since
15.0.0
Return values
\OCP\FullTextSearch\Model\IIndexDocument[]

setDocuments()

Set an array of IIndexDocument as the result of the search request.

public setDocuments(\OCP\FullTextSearch\Model\IIndexDocument[] $documents) : ISearchResult
Parameters
$documents : \OCP\FullTextSearch\Model\IIndexDocument[]
Tags
since
15.0.0
Return values
ISearchResult

setTotal()

Set the total number of results for the search request.

public setTotal(int $total) : ISearchResult

Used by pagination.

Parameters
$total : int
Tags
since
15.0.0
Return values
ISearchResult

Search results