Nextcloud PHP API (stable18)

IIndexDocument

Class IIndexDocument

This is one of the main class of the FullTextSearch, used as a data transfer object. An IIndexDocument is created to manage documents around FullTextSearch, during an index and during a search. The uniqueness of an IIndexDocument is made by the Id of the Content Provider and the Id of the original document within the Content Provider.

We will call original document the source from which the IIndexDocument is generated. As an example, an original document can be a file, a mail, ...

Tags
since
15.0.0

Table of Contents

ENCODED_BASE64  = 1
NOT_ENCODED  = 0
addExcerpt()  : IIndexDocument
Add some excerpt of the content of the original document, usually based on the search request.
addMetaTag()  : IIndexDocument
Add a meta tag to the list.
addPart()  : IIndexDocument
Add a part, identified by a string, and its content.
addSubTag()  : IIndexDocument
Add a sub tag to the list.
addTag()  : IIndexDocument
Add a tag to the list.
getAccess()  : IDocumentAccess
Get the IDocumentAccess related to the original document.
getContent()  : string
Get the content of the original document.
getContentSize()  : int
Return the size of the content.
getExcerpts()  : array
Get all excerpts of the content of the original document.
getHash()  : string
Get the hash of the original document.
getId()  : string
Returns the Id of the original document.
getIndex()  : IIndex
Get the Index.
getInfo()  : string
Get an information about a document. (string)
getInfoAll()  : array
Get all info.
getInfoArray()  : array
Get an information about a document. (array)
getInfoBool()  : bool
Get an information about a document. (bool)
getInfoInt()  : int
Get an information about a document. (int)
getLink()  : string
Get the link.
getMetaTags()  : array
Get the list of meta tags assigned to the original document.
getModifiedTime()  : int
Get the modified time of the original document.
getMore()  : array
Get more information.
getParts()  : array
Get all parts of the IIndexDocument.
getProviderId()  : string
Returns the Id of the provider.
getScore()  : string
Get the score.
getSource()  : string
Get the source of the original document.
getSubTags()  : array
Get the list of sub tags assigned to the original document.
getTags()  : array
Get the list of tags assigned to the original document.
getTitle()  : string
Get the title of the original document.
hasIndex()  : bool
return if Index is defined.
initHash()  : IIndexDocument
Generate an hash, based on the content of the original document.
isContentEncoded()  : int
Returns the type of the encoding on the content.
isOlderThan()  : bool
Check if the original document of the IIndexDocument is older than $time.
setAccess()  : $this
Set the read rights of the original document using a IDocumentAccess.
setContent()  : IIndexDocument
Set the content of the document.
setExcerpts()  : IIndexDocument
Set all excerpts of the content of the original document.
setHash()  : IIndexDocument
Set the hash of the original document.
setIndex()  : IIndexDocument
Set the Index related to the IIndexDocument.
setInfo()  : IIndexDocument
Set some information about the original document that will be available to the front-end when displaying search result. (as string) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.
setInfoArray()  : IIndexDocument
Set some information about the original document that will be available to the front-end when displaying search result. (as array) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.
setInfoBool()  : IIndexDocument
Set some information about the original document that will be available to the front-end when displaying search result. (as bool) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.
setInfoInt()  : IIndexDocument
Set some information about the original document that will be available to the front-end when displaying search result. (as int) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.
setLink()  : IIndexDocument
Add a link, usable by the frontend.
setMetaTags()  : IIndexDocument
Set the list of meta tags assigned to the original document.
setModifiedTime()  : IIndexDocument
Set the modified time of the original document.
setMore()  : IIndexDocument
Set more information that couldn't be set using other method.
setParts()  : IIndexDocument
Set all parts and their content.
setScore()  : IIndexDocument
Set the score to the result assigned to this document during a search request.
setSource()  : IIndexDocument
Set the source of the original document.
setSubTags()  : IIndexDocument
Set the list of sub tags assigned to the original document.
setTags()  : IIndexDocument
Set the list of tags assigned to the original document.
setTitle()  : IIndexDocument
Set the title of the original document.

Constants

Methods

addExcerpt()

Add some excerpt of the content of the original document, usually based on the search request.

public addExcerpt(string $source, string $excerpt) : IIndexDocument
Parameters
$source : string
$excerpt : string
Tags
since
16.0.0
Return values
IIndexDocument

addPart()

Add a part, identified by a string, and its content.

public addPart(string $part, string $content) : IIndexDocument

It is strongly advised to use alphanumerical chars with no space in the $part string.

Parameters
$part : string
$content : string
Tags
since
15.0.0
Return values
IIndexDocument

getContent()

Get the content of the original document.

public getContent() : string
Tags
since
15.0.0
Return values
string

getContentSize()

Return the size of the content.

public getContentSize() : int
Tags
since
15.0.0
Return values
int

getExcerpts()

Get all excerpts of the content of the original document.

public getExcerpts() : array
Tags
since
15.0.0
Return values
array

getHash()

Get the hash of the original document.

public getHash() : string
Tags
since
15.0.0
Return values
string

getId()

Returns the Id of the original document.

public getId() : string
Tags
since
15.0.0
Return values
string

getInfo()

Get an information about a document. (string)

public getInfo(string $info[, string $default = '' ]) : string
Parameters
$info : string
$default : string = ''
Tags
since
15.0.0
Return values
string

getInfoAll()

Get all info.

public getInfoAll() : array
Tags
since
15.0.0
Return values
array

getInfoArray()

Get an information about a document. (array)

public getInfoArray(string $info[, array $default = [] ]) : array
Parameters
$info : string
$default : array = []
Tags
since
15.0.0
Return values
array

getInfoBool()

Get an information about a document. (bool)

public getInfoBool(string $info[, bool $default = false ]) : bool
Parameters
$info : string
$default : bool = false
Tags
since
15.0.0
Return values
bool

getInfoInt()

Get an information about a document. (int)

public getInfoInt(string $info, int $default) : int
Parameters
$info : string
$default : int
Tags
since
15.0.0
Return values
int

Get the link.

public getLink() : string
Tags
since
15.0.0
Return values
string

getMetaTags()

Get the list of meta tags assigned to the original document.

public getMetaTags() : array
Tags
since
15.0.0
Return values
array

getModifiedTime()

Get the modified time of the original document.

public getModifiedTime() : int
Tags
since
15.0.0
Return values
int

getMore()

Get more information.

public getMore() : array
Tags
since
15.0.0
Return values
array

getParts()

Get all parts of the IIndexDocument.

public getParts() : array
Tags
since
15.0.0
Return values
array

getProviderId()

Returns the Id of the provider.

public getProviderId() : string
Tags
since
15.0.0
Return values
string

getScore()

Get the score.

public getScore() : string
Tags
since
15.0.0
Return values
string

getSource()

Get the source of the original document.

public getSource() : string
Tags
since
15.0.0
Return values
string

getSubTags()

Get the list of sub tags assigned to the original document.

public getSubTags([bool $formatted = false ]) : array

If $formatted is true, the result will be formatted in a one dimensional array.

Parameters
$formatted : bool = false
Tags
since
15.0.0
Return values
array

getTags()

Get the list of tags assigned to the original document.

public getTags() : array
Tags
since
15.0.0
Return values
array

getTitle()

Get the title of the original document.

public getTitle() : string
Tags
since
15.0.0
Return values
string

hasIndex()

return if Index is defined.

public hasIndex() : bool
Tags
since
16.0.0
Return values
bool

isContentEncoded()

Returns the type of the encoding on the content.

public isContentEncoded() : int
Tags
since
15.0.0
Return values
int

isOlderThan()

Check if the original document of the IIndexDocument is older than $time.

public isOlderThan(int $time) : bool
Parameters
$time : int
Tags
since
15.0.0
Return values
bool

setContent()

Set the content of the document.

public setContent(string $content, int $encoded) : IIndexDocument

$encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or encoded in base64.

Parameters
$content : string
$encoded : int
Tags
since
15.0.0
Return values
IIndexDocument

setExcerpts()

Set all excerpts of the content of the original document.

public setExcerpts(array $excerpts) : IIndexDocument
Parameters
$excerpts : array
Tags
since
16.0.0
Return values
IIndexDocument

setInfo()

Set some information about the original document that will be available to the front-end when displaying search result. (as string) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.

public setInfo(string $info, string $value) : IIndexDocument
Parameters
$info : string
$value : string
Tags
since
15.0.0
Return values
IIndexDocument

setInfoArray()

Set some information about the original document that will be available to the front-end when displaying search result. (as array) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.

public setInfoArray(string $info, array $value) : IIndexDocument
Parameters
$info : string
$value : array
Tags
since
15.0.0
Return values
IIndexDocument

setInfoBool()

Set some information about the original document that will be available to the front-end when displaying search result. (as bool) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.

public setInfoBool(string $info, bool $value) : IIndexDocument
Parameters
$info : string
$value : bool
Tags
since
15.0.0
Return values
IIndexDocument

setInfoInt()

Set some information about the original document that will be available to the front-end when displaying search result. (as int) Because this information will not be indexed, this method can also be used to manage some data while filling the IIndexDocument before its indexing.

public setInfoInt(string $info, int $value) : IIndexDocument
Parameters
$info : string
$value : int
Tags
since
15.0.0
Return values
IIndexDocument

setModifiedTime()

Set the modified time of the original document.

public setModifiedTime(int $modifiedTime) : IIndexDocument
Parameters
$modifiedTime : int
Tags
since
15.0.0
Return values
IIndexDocument

setScore()

Set the score to the result assigned to this document during a search request.

public setScore(string $score) : IIndexDocument
Parameters
$score : string
Tags
since
15.0.0
Return values
IIndexDocument

Search results