Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
search_solr\schema Class Reference

Schema class to interact with Solr schema. More...

Public Member Functions

 __construct (engine $engine=null)
 Constructor.
 
 can_setup_server ()
 Can setup be executed against the configured server.
 
 setup ($checkexisting=true)
 Setup solr stuff required by moodle.
 
 validate_setup ()
 Checks the schema is properly set up.
 

Protected Member Functions

 add_fields ($fields, $checkexisting=true)
 Adds the provided fields to Solr schema.
 
 check_index ()
 Checks if the index is ready, triggers an exception otherwise.
 
 validate_add_field_result ($result)
 Checks that the field results do not contain errors.
 
 validate_fields (&$fields, $requireexisting=false)
 Checks if the schema existing fields are properly set, triggers an exception otherwise.
 

Protected Attributes

stdClass $config = null
 
curl $curl = null
 cUrl instance.
 
engine $engine = null
 An engine instance.
 

Detailed Description

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.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

search_solr\schema::__construct ( engine $engine = null)

Constructor.

Parameters
engine$engineOptional engine parameter, if not specified then one will be created
Exceptions
moodle_exception
Return values
void

Member Function Documentation

◆ add_fields()

search_solr\schema::add_fields ( $fields,
$checkexisting = true )
protected

Adds the provided fields to Solr schema.

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

Exceptions
coding_exception
moodle_exception
Parameters
array$fieldscore_search\document\$requiredfields format
bool$checkexistingWhether to check if the fields already exist or not
Return values
bool

◆ can_setup_server()

search_solr\schema::can_setup_server ( )

Can setup be executed against the configured server.

Return values
true|stringTrue or error message.

◆ check_index()

search_solr\schema::check_index ( )
protected

Checks if the index is ready, triggers an exception otherwise.

Exceptions
moodle_exception
Return values
void

◆ setup()

search_solr\schema::setup ( $checkexisting = true)

Setup solr stuff required by moodle.

Parameters
bool$checkexistingWhether to check if the fields already exist or not
Return values
bool

◆ validate_add_field_result()

search_solr\schema::validate_add_field_result ( $result)
protected

Checks that the field results do not contain errors.

Exceptions
moodle_exception
Parameters
string$resultscurl response body
Return values
void

◆ validate_fields()

search_solr\schema::validate_fields ( & $fields,
$requireexisting = false )
protected

Checks if the schema existing fields are properly set, triggers an exception otherwise.

Exceptions
moodle_exception
Parameters
array$fields
bool$requireexistingRequire the fields to exist, otherwise exception.
Return values
void

◆ validate_setup()

search_solr\schema::validate_setup ( )

Checks the schema is properly set up.

Exceptions
moodle_exception
Return values
void

The documentation for this class was generated from the following file: