Respresents a document to index.
More...
|
const | INDEXED_FILE_ERROR = -1 |
| Indicates the file contents were not indexed due to an error.
|
|
const | INDEXED_FILE_FALSE = 0 |
| Indicates the file contents were not indexed due filtering/settings.
|
|
const | INDEXED_FILE_TRUE = 1 |
| Indicates the file contents are indexed with the record.
|
|
int const | SCHEMA_VERSION = 2017091700 |
| Change list (for engine implementers): 2017091700 - add optional field groupid. More...
|
|
Respresents a document to index.
- Copyright
- 2015 David Monllao http://www.davidmonllao.com
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ add_stored_file()
core_search\document::add_stored_file |
( |
|
$file | ) |
|
|
inherited |
Add a stored file to the document.
- Parameters
-
- Return values
-
◆ apply_defaults()
search_solr\document::apply_defaults |
( |
| ) |
|
|
protected |
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().
Reimplemented from core_search\document.
◆ export_file_for_engine()
search_solr\document::export_file_for_engine |
( |
|
$file | ) |
|
Export the data for the given file in relation to this document.
- Parameters
-
- Return values
-
◆ export_for_engine()
core_search\document::export_for_engine |
( |
| ) |
|
|
inherited |
Returns the document ready to submit to the search engine.
- Exceptions
-
- Return values
-
◆ export_for_template() [1/2]
core_search\document::export_for_template |
( |
\renderer_base |
$output | ) |
|
|
inherited |
Export the document data to be used as a template context.
Adding more info than the required one as people might be interested in extending the template.
Although content is a required field when setting up the document, it accepts '' (empty) values as they may be the result of striping out HTML.
SECURITY NOTE: It is the responsibility of the document to properly escape any text to be displayed. The renderer will output the content without any further cleaning.
- Parameters
-
- Return values
-
◆ export_for_template() [2/2]
Function to export the renderer data in a format that is suitable for a mustache template.
This means:
- No complex types - only stdClass, array, int, string, float, bool
- Any additional info that is required for the template is pre-calculated (e.g. capability checks).
- Parameters
-
renderer_base | $output | Used to do a final render of any components that need to be rendered for export. |
- Return values
-
Implemented in forumreport_summary\output\filters, core_user\output\unified_filter, core_user\output\status_field, core_tag\output\taglist, core_tag\output\tagindex, core_tag\output\tagfeed, core_tag\output\tagcloud, core_tag\output\tag, report_competency\output\user_course_navigation, report_competency\output\report, core_privacy\output\exported_navigation_page, core_privacy\output\exported_html_page, MoodleQuickForm_wikieditor, mod_lti\output\tool_configure_page, mod_lti\output\external_registration_return_page, mod_forum\output\quick_search_form, mod_forum\output\big_search_form, mod_feedback\output\summary, booktool_print\output\print_book_page, booktool_print\output\print_book_chapter_page, assign_attempt_history_chooser, mod_assign\output\grading_app, login_signup_form, progress_bar, action_menu, tabtree, tabobject, custom_menu_item, initials_bar, paging_bar, url_select, single_select, pix_icon, pix_icon_font, help_icon, component_action, MoodleQuickForm_warning, MoodleQuickForm_url, MoodleQuickForm_textarea, MoodleQuickForm_tags, MoodleQuickForm_submit, MoodleQuickForm_static, MoodleQuickForm_selectwithlink, MoodleQuickForm_selectgroups, MoodleQuickForm_select, MoodleQuickForm_recaptcha, MoodleQuickForm_passwordunmask, MoodleQuickForm_group, MoodleQuickForm_grading, MoodleQuickForm_filepicker, MoodleQuickForm_filemanager, MoodleQuickForm_editor, MoodleQuickForm_date_time_selector, MoodleQuickForm_date_selector, MoodleQuickForm_checkbox, MoodleQuickForm_autocomplete, MoodleQuickForm_advcheckbox, core\output\chooser_section, core\output\chooser_item, core\output\chooser, core\output\checkbox_toggleall, core_group\output\index_page, core_group\output\group_details, enrol_lti\output\registration, core_course\output\modchooser, block_timeline\output\main, block_starredcourses\output\main, block_search_forums\output\search_form, block_recentlyaccesseditems\output\main, block_recentlyaccessedcourses\output\main, block_myprofile\output\myprofile, block_myoverview\output\main, block_lp\output\summary, block_lp\output\plans_to_review_page, block_lp\output\competencies_to_review_page, core_auth\output\verify_age_location_page, core_auth\output\login, core_auth\output\digital_minor_page, tool_templatelibrary\output\list_templates_page, tool_policy\output\page_viewdoc, tool_policy\output\page_viewalldoc, tool_policy\output\page_nopermission, tool_policy\output\page_managedocs_list, tool_policy\output\page_agreedocs, tool_policy\output\guestconsent, tool_policy\output\acceptances, tool_lp\output\user_evidence_list_page, tool_lp\output\user_competency_summary_in_course, tool_lp\output\user_competency_summary, tool_lp\output\user_competency_course_navigation, tool_lp\output\template_competencies_page, tool_lp\output\related_competencies, tool_lp\output\plans_page, tool_lp\output\module_navigation, tool_lp\output\manage_templates_page, tool_lp\output\manage_competency_frameworks_page, tool_lp\output\manage_competencies_page, tool_lp\output\course_competencies_page, tool_lp\output\competency_summary, tool_lp\output\competency_plan_navigation, tool_langimport\output\langimport_page, tool_dataprivacy\output\summary_page, tool_dataprivacy\output\request_filter, tool_dataprivacy\output\purposes, tool_dataprivacy\output\my_data_requests_page, tool_dataprivacy\output\defaults_page, tool_dataprivacy\output\data_requests_page, tool_dataprivacy\output\data_registry_page, tool_dataprivacy\output\data_registry_compliance_page, tool_dataprivacy\output\data_deletion_page, tool_dataprivacy\output\categories, and tool_customlang\output\translator.
◆ format_string_for_engine()
static search_solr\document::format_string_for_engine |
( |
|
$string | ) |
|
|
static |
Formats the timestamp according to the search engine needs.
- Parameters
-
- Return values
-
Reimplemented from core_search\document.
◆ format_text()
search_solr\document::format_text |
( |
|
$text | ) |
|
|
protected |
Formats a text string coming from the search engine.
- Parameters
-
string | $text | Text to format |
- Return values
-
string | HTML text to be renderer |
Reimplemented from core_search\document.
◆ format_text_for_engine()
static core_search\document::format_text_for_engine |
( |
|
$text | ) |
|
|
staticinherited |
Formats a text value for the search engine.
Search engines may overwrite this method to apply restrictions, like limiting the size. The default behaviour is just returning the string.
- Parameters
-
- Return values
-
◆ format_time_for_engine()
static search_solr\document::format_time_for_engine |
( |
|
$timestamp | ) |
|
|
static |
Formats the timestamp according to the search engine needs.
- Parameters
-
- Return values
-
Reimplemented from core_search\document.
◆ get()
core_search\document::get |
( |
|
$field | ) |
|
|
inherited |
Getter.
Use self::is_set if you are not sure if this field is set or not as otherwise it will trigger a coding_exception
- Exceptions
-
- Parameters
-
- Return values
-
◆ get_context_url()
core_search\document::get_context_url |
( |
| ) |
|
|
inherited |
Gets the url to the context.
- Return values
-
◆ get_default_fields_definition()
static core_search\document::get_default_fields_definition |
( |
| ) |
|
|
staticinherited |
Returns all default fields definitions.
- Return values
-
◆ get_doc_icon()
core_search\document::get_doc_icon |
( |
| ) |
|
|
inherited |
Gets document icon instance.
- Return values
-
◆ get_doc_url()
core_search\document::get_doc_url |
( |
| ) |
|
|
inherited |
Gets the url to the doc.
- Return values
-
◆ get_files()
core_search\document::get_files |
( |
| ) |
|
|
inherited |
Returns the array of attached files.
- Return values
-
◆ get_is_new()
core_search\document::get_is_new |
( |
| ) |
|
|
inherited |
Returns if the document is new.
False if unknown.
- Return values
-
◆ get_text_format()
search_solr\document::get_text_format |
( |
| ) |
|
|
protected |
Overwritten to use markdown format as we use markdown for solr highlighting.
- Return values
-
Reimplemented from core_search\document.
◆ import_time_from_engine()
static search_solr\document::import_time_from_engine |
( |
|
$time | ) |
|
|
static |
Returns a timestamp from the value stored in the search engine.
- Parameters
-
- Return values
-
Reimplemented from core_search\document.
◆ is_set()
core_search\document::is_set |
( |
|
$field | ) |
|
|
inherited |
Checks if a field is set.
- Parameters
-
- Return values
-
◆ set()
core_search\document::set |
( |
|
$fieldname, |
|
|
|
$value |
|
) |
| |
|
inherited |
Setter.
Basic checkings to prevent common issues.
If the field is a string tags will be stripped, if it is an integer or a date it will be casted to a PHP integer. tdate fields values are expected to be timestamps.
- Exceptions
-
- Parameters
-
string | $fieldname | The field name |
string | int | $value | The value to store |
- Return values
-
string|int | The stored value |
◆ set_data_from_engine()
core_search\document::set_data_from_engine |
( |
|
$docdata | ) |
|
|
inherited |
Fills the document with data coming from the search engine.
- Exceptions
-
◆ set_doc_icon()
Sets document icon instance.
- Parameters
-
core_search\document_icon | $docicon | |
◆ set_doc_url()
core_search\document::set_doc_url |
( |
\moodle_url |
$url | ) |
|
|
inherited |
Sets the document url.
- Parameters
-
- Return values
-
◆ set_extra()
core_search\document::set_extra |
( |
|
$fieldname, |
|
|
|
$value |
|
) |
| |
|
inherited |
Sets data to this->extradata.
This data can be retrieved using core_search\document->get($fieldname).
- Parameters
-
string | $fieldname | |
string | $value | |
- Return values
-
◆ set_is_new()
core_search\document::set_is_new |
( |
|
$new | ) |
|
|
inherited |
Set if this is a new document.
False if unknown.
- Parameters
-
◆ $enginefields
array search_solr\document::$enginefields |
|
staticprotected |
Initial value:= array(
'solr_filegroupingid' => array(
'type' => 'string',
'stored' => true,
'indexed' => true
),
'solr_fileid' => array(
'type' => 'string',
'stored' => true,
'indexed' => true
),
'solr_filecontenthash' => array(
'type' => 'string',
'stored' => true,
'indexed' => true
),
'solr_fileindexstatus' => array(
'type' => 'int',
'stored' => true,
'indexed' => true
),
'solr_filecontent' => array(
'type' => 'text',
'stored' => false,
'indexed' => true,
'mainquery' => true
)
)
Any fields that are engine specifc.
These are fields that are solely used by a seach engine plugin for internal purposes.
◆ $isnew
bool core_search\document::$isnew = false |
|
protectedinherited |
Should be set to true if document hasn't been indexed before.
False if unknown.
◆ $optionalfields
array core_search\document::$optionalfields |
|
staticprotectedinherited |
Initial value:= array(
'userid' => array(
'type' => 'int',
'stored' => true,
'indexed' => true
),
'groupid' => array(
'type' => 'int',
'stored' => true,
'indexed' => true
),
'description1' => array(
'type' => 'text',
'stored' => true,
'indexed' => true,
'mainquery' => true
),
'description2' => array(
'type' => 'text',
'stored' => true,
'indexed' => true,
'mainquery' => true
)
)
All optional fields docs can contain.
Although it matches solr fields format, this is just to define the field types. Search engine plugins are responsible of setting their appropriate field types and map these naming to whatever format they need.
◆ $requiredfields
array core_search\document::$requiredfields |
|
staticprotectedinherited |
All required fields any doc should contain.
We have to choose a format to specify field types, using solr format as we have to choose one and solr is the default search engine.
Search engine plugins are responsible of setting their appropriate field types and map these naming to whatever format they need.
◆ SCHEMA_VERSION
int const core_search\document::SCHEMA_VERSION = 2017091700 |
|
inherited |
Change list (for engine implementers): 2017091700 - add optional field groupid.
Schema version number (update if any change)
The documentation for this class was generated from the following file: