IndexDocument

class OC\FullTextSearch\Model\IndexDocument
Class IndexDocument
This is one of the main class of the FullTextSearch, used as a data transfer
object. An IndexDocument is created to manage documents around FullTextSearch,
during an index and during a search.
The uniqueness of an IndexDocument 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 IndexDocument is
generated. As an example, an original document can be a file, a mail, ...
Source:lib/private/FullTextSearch/Model/IndexDocument.php#50
Implements:OCP\FullTextSearch\Model\IIndexDocument JsonSerializable

Properties

protected static property OC\FullTextSearch\Model\IndexDocument::$id
Source:lib/private/FullTextSearch/Model/IndexDocument.php#54
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$providerId
Source:lib/private/FullTextSearch/Model/IndexDocument.php#57
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$access
Source:lib/private/FullTextSearch/Model/IndexDocument.php#60
Type:\OC\FullTextSearch\Model\DocumentAccess
protected static property OC\FullTextSearch\Model\IndexDocument::$index
Source:lib/private/FullTextSearch/Model/IndexDocument.php#63
Type:\OCP\FullTextSearch\Model\IIndex
protected static property OC\FullTextSearch\Model\IndexDocument::$modifiedTime
Source:lib/private/FullTextSearch/Model/IndexDocument.php#66
Type:int
protected static property OC\FullTextSearch\Model\IndexDocument::$source
Source:lib/private/FullTextSearch/Model/IndexDocument.php#69
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$tags
Source:lib/private/FullTextSearch/Model/IndexDocument.php#72
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$metaTags
Source:lib/private/FullTextSearch/Model/IndexDocument.php#75
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$subTags
Source:lib/private/FullTextSearch/Model/IndexDocument.php#78
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$title
Source:lib/private/FullTextSearch/Model/IndexDocument.php#81
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$content
Source:lib/private/FullTextSearch/Model/IndexDocument.php#84
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$hash
Source:lib/private/FullTextSearch/Model/IndexDocument.php#87
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$parts
Source:lib/private/FullTextSearch/Model/IndexDocument.php#90
Type:array
Source:lib/private/FullTextSearch/Model/IndexDocument.php#93
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$more
Source:lib/private/FullTextSearch/Model/IndexDocument.php#96
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$excerpts
Source:lib/private/FullTextSearch/Model/IndexDocument.php#99
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$score
Source:lib/private/FullTextSearch/Model/IndexDocument.php#102
Type:string
protected static property OC\FullTextSearch\Model\IndexDocument::$info
Source:lib/private/FullTextSearch/Model/IndexDocument.php#105
Type:array
protected static property OC\FullTextSearch\Model\IndexDocument::$contentEncoded
Source:lib/private/FullTextSearch/Model/IndexDocument.php#108
Type:int

Methods

public OC\FullTextSearch\Model\IndexDocument::__construct($providerId, $documentId)
IIndexDocument constructor.
On creation, we assure the uniqueness of the object using the providerId
and the Id of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#122

Parameters:
  • $providerId (string)
  • $documentId (string)
Since:

15.0.0

public final OC\FullTextSearch\Model\IndexDocument::getId()
Returns the Id of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#135
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::getProviderId()
Returns the Id of the provider.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#147
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::setIndex($index)
Set the Index related to the IIndexDocument.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#163

Parameters:
See:

\OCP\FullTextSearch\Model\IIndex

Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getIndex()
Get the Index.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#176
Since:15.0.0
Returns:\OCP\FullTextSearch\Model\IIndex
public final OC\FullTextSearch\Model\IndexDocument::hasIndex()
return if Index is defined.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#187
Since:16.0.0
Returns:bool
public final OC\FullTextSearch\Model\IndexDocument::setModifiedTime($modifiedTime)
Set the modified time of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#201

Parameters:
  • $modifiedTime (int)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getModifiedTime()
Get the modified time of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#214
Since:15.0.0
Returns:int
public final OC\FullTextSearch\Model\IndexDocument::isOlderThan($time)
Check if the original document of the IIndexDocument is older than $time.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#227

Parameters:
  • $time (int)
Since:

15.0.0

Returns:

bool

public final OC\FullTextSearch\Model\IndexDocument::setAccess($access)
Set the read rights of the original document using a IDocumentAccess.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#243

Parameters:
See:

\OCP\FullTextSearch\Model\IDocumentAccess

Since:

15.0.0

Returns:

$this

public final OC\FullTextSearch\Model\IndexDocument::getAccess()
Get the IDocumentAccess related to the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#256
Since:15.0.0
Returns:\OCP\FullTextSearch\Model\IDocumentAccess
public final OC\FullTextSearch\Model\IndexDocument::addTag($tag)
Add a tag to the list.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#270

Parameters:
  • $tag (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::setTags($tags)
Set the list of tags assigned to the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#285

Parameters:
  • $tags (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getTags()
Get the list of tags assigned to the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#298
Since:15.0.0
Returns:array
public final OC\FullTextSearch\Model\IndexDocument::addMetaTag($tag)
Add a meta tag to the list.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#312

Parameters:
  • $tag (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::setMetaTags($tags)
Set the list of meta tags assigned to the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#327

Parameters:
  • $tags (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getMetaTags()
Get the list of meta tags assigned to the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#340
Since:15.0.0
Returns:array
public final OC\FullTextSearch\Model\IndexDocument::addSubTag($sub, $tag)
Add a sub tag to the list.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#355

Parameters:
  • $sub (string)
  • $tag (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::setSubTags($tags)
Set the list of sub tags assigned to the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#375

Parameters:
  • $tags (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getSubTags($formatted=false)
Get the list of sub tags assigned to the original document.
If $formatted is true, the result will be formatted in a one
dimensional array.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#392

Parameters:
  • $formatted (bool)
Since:

15.0.0

Returns:

array

public final OC\FullTextSearch\Model\IndexDocument::setSource($source)
Set the source of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#419

Parameters:
  • $source (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getSource()
Get the source of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#432
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::setTitle($title)
Set the title of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#446

Parameters:
  • $title (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getTitle()
Get the title of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#459
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::setContent($content, $encoded=0)
Set the content of the document.
$encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or
encoded in base64.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#476

Parameters:
  • $content (string)
  • $encoded (int)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getContent()
Get the content of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#490
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::isContentEncoded()
Returns the type of the encoding on the content.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#501
Since:15.0.0
Returns:int
public final OC\FullTextSearch\Model\IndexDocument::getContentSize()
Return the size of the content.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#512
Since:15.0.0
Returns:int
public final OC\FullTextSearch\Model\IndexDocument::initHash()
Generate an hash, based on the content of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#524
Since:15.0.0
Returns:\OCP\FullTextSearch\Model\IIndexDocument
public final OC\FullTextSearch\Model\IndexDocument::setHash($hash)
Set the hash of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#543

Parameters:
  • $hash (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getHash()
Get the hash of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#556
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::addPart($part, $content)
Add a part, identified by a string, and its content.
It is strongly advised to use alphanumerical chars with no space in the
$part string.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#574

Parameters:
  • $part (string)
  • $content (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::setParts($parts)
Set all parts and their content.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#589

Parameters:
  • $parts (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getParts()
Get all parts of the IIndexDocument.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#602
Since:15.0.0
Returns:array
Add a link, usable by the frontend.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#616

Parameters:
  • $link (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

Get the link.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#629
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::setMore($more)
Set more information that couldn’t be set using other method.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#643

Parameters:
  • $more (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getMore()
Get more information.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#656
Since:15.0.0
Returns:array
public final OC\FullTextSearch\Model\IndexDocument::addExcerpt($source, $excerpt)
Add some excerpt of the content of the original document, usually based
on the search request.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#672

Parameters:
  • $source (string)
  • $excerpt (string)
Since:

16.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::setExcerpts($excerpts)
Set all excerpts of the content of the original document.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#692

Parameters:
  • $excerpts (array)
Since:

16.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getExcerpts()
Get all excerpts of the content of the original document.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#713
Since:15.0.0
Returns:array
public final OC\FullTextSearch\Model\IndexDocument::setScore($score)
Set the score to the result assigned to this document during a search
request.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#747

Parameters:
  • $score (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getScore()
Get the score.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#760
Since:15.0.0
Returns:string
public final OC\FullTextSearch\Model\IndexDocument::setInfo($info, $value)
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.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#779

Parameters:
  • $info (string)
  • $value (string)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getInfo($info, $default="")
Get an information about a document. (string)
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#795

Parameters:
  • $info (string)
  • $default (string)
Since:

15.0.0

Returns:

string

public final OC\FullTextSearch\Model\IndexDocument::setInfoArray($info, $value)
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.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#817

Parameters:
  • $info (string)
  • $value (array)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getInfoArray($info, $default=[])
Get an information about a document. (array)
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#833

Parameters:
  • $info (string)
  • $default (array)
Since:

15.0.0

Returns:

array

public final OC\FullTextSearch\Model\IndexDocument::setInfoInt($info, $value)
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.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#855

Parameters:
  • $info (string)
  • $value (int)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getInfoInt($info, $default=0)
Get an information about a document. (int)
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#871

Parameters:
  • $info (string)
  • $default (int)
Since:

15.0.0

Returns:

int

public final OC\FullTextSearch\Model\IndexDocument::setInfoBool($info, $value)
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.
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#893

Parameters:
  • $info (string)
  • $value (bool)
Since:

15.0.0

Returns:

\OCP\FullTextSearch\Model\IIndexDocument

public final OC\FullTextSearch\Model\IndexDocument::getInfoBool($info, $default=false)
Get an information about a document. (bool)
Source:

lib/private/FullTextSearch/Model/IndexDocument.php#909

Parameters:
  • $info (string)
  • $default (bool)
Since:

15.0.0

Returns:

bool

public final OC\FullTextSearch\Model\IndexDocument::getInfoAll()
Get all info.
Source:lib/private/FullTextSearch/Model/IndexDocument.php#924
Since:15.0.0
Returns:array
public OC\FullTextSearch\Model\IndexDocument::__destruct()
Source:lib/private/FullTextSearch/Model/IndexDocument.php#945
Since:15.0.0 On some version of PHP, it is better to force destruct the object. And during the index, the number of generated IIndexDocument can be _huge_.
public OC\FullTextSearch\Model\IndexDocument::jsonSerialize()
Source:lib/private/FullTextSearch/Model/IndexDocument.php#970
Since:15.0.0
Returns:array