Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

Solr schema manipulation manager.

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

Defines 1 class


Class: schema  - X-Ref

Schema class to interact with Solr schema.

At the moment it only implements create which should be enough for a basic
moodle configuration in Solr.

__construct()   X-Ref
Constructor.

return: void

can_setup_server()   X-Ref
Can setup be executed against the configured server.

return: true|string True or error message.

setup($checkexisting = true)   X-Ref
Setup solr stuff required by moodle.

param: bool $checkexisting Whether to check if the fields already exist or not
return: bool

validate_setup()   X-Ref
Checks the schema is properly set up.

return: void

check_index()   X-Ref
Checks if the index is ready, triggers an exception otherwise.

return: void

add_fields($fields, $checkexisting = true)   X-Ref
Adds the provided fields to Solr schema.

Intentionally separated from create(), it can be called to add extra fields.
fields separately.

param: array $fields \core_search\document::$requiredfields format
param: bool $checkexisting Whether to check if the fields already exist or not
return: bool

validate_fields(&$fields, $requireexisting = false)   X-Ref
Checks if the schema existing fields are properly set, triggers an exception otherwise.

param: array $fields
param: bool $requireexisting Require the fields to exist, otherwise exception.
return: void

validate_add_field_result($result)   X-Ref
Checks that the field results do not contain errors.

param: string $results curl response body
return: void

doc_field_to_solr_field($datatype)   X-Ref
Returns the solr field type from the document field type string.

param: string $datatype
return: string