Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
search_solr\schema Class Reference

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

Public Member Functions

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

Protected Member Functions

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

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 ( )

Constructor.

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: