Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

Document representation.

Copyright: 2015 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 208 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: document  - X-Ref

Respresents a document to index.

format_time_for_engine($timestamp)   X-Ref
Formats the timestamp according to the search engine needs.

param: int $timestamp
return: string

format_string_for_engine($string)   X-Ref
Formats the timestamp according to the search engine needs.

param: int $timestamp
return: string

import_time_from_engine($time)   X-Ref
Returns a timestamp from the value stored in the search engine.

param: string $time
return: int

get_text_format()   X-Ref
Overwritten to use HTML (highlighting).

return: int

format_text($text)   X-Ref
Formats a text string coming from the search engine.

Even if this is called through an external function it is fine to return HTML as
HTML is considered solr's search engine text format. An external function can ask
for raw text, but this just means that it will not pass through format_text, no that
we can not add HTML.

param: string $text Text to format
return: string HTML text to be renderer

apply_defaults()   X-Ref
Apply any defaults to unset fields before export. Called after document building, but before export.

Sub-classes of this should make sure to call parent::apply_defaults().

export_file_for_engine($file)   X-Ref
Export the data for the given file in relation to this document.

param: \stored_file $file The stored file we are talking about.
return: array