original_string: public function get_document($record, $options = array()) {
  
          $context = \context_system::instance();
  
          // Prepare associative array with data from DB.
          $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
          // Include all alternate names in title.
          $array = [];
          foreach (get_all_user_name_fields(false, null, null, null, true) as $field) {
              $array[$field] = $record->$field;
          }
          $fullusername = join(' ', $array);
          // Assigning properties to our document.
          $doc->set('title', content_to_text($fullusername, false));
          $doc->set('contextid', $context->id);
          $doc->set('courseid', SITEID);
          $doc->set('itemid', $record->id);
          $doc->set('modified', $record->timemodified);
          $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
          $doc->set('content', content_to_text($record->description, $record->descriptionformat));
  
          // Check if this document should be considered new.
          if (isset($options['lastindexedtime']) && $options['lastindexedtime'] < $record->timecreated) {
              // If the document was created after the last index time, it must be new.
              $doc->set_is_new(true);
          }
  
          return $doc;
      }
code: public function get_document($record, $options = array()) {
  
          $context = \context_system::instance();
  
          // Prepare associative array with data from DB.
          $doc = \core_search\document_factory::instance($record->id, $this->componentname, $this->areaname);
          // Include all alternate names in title.
          $array = [];
          foreach (get_all_user_name_fields(false, null, null, null, true) as $field) {
              $array[$field] = $record->$field;
          }
          $fullusername = join(' ', $array);
          // Assigning properties to our document.
          $doc->set('title', content_to_text($fullusername, false));
          $doc->set('contextid', $context->id);
          $doc->set('courseid', SITEID);
          $doc->set('itemid', $record->id);
          $doc->set('modified', $record->timemodified);
          $doc->set('owneruserid', \core_search\manager::NO_OWNER_ID);
          $doc->set('content', content_to_text($record->description, $record->descriptionformat));
  
          // Check if this document should be considered new.
          if (isset($options['lastindexedtime']) && $options['lastindexedtime'] < $record->timecreated) {
              // If the document was created after the last index time, it must be new.
              $doc->set_is_new(true);
          }
  
          return $doc;
      }
code_tokens: public function get_document ( $ record , $ options = array ( ) ) { $ context = \ context_system :: instance ( ) ; // Prepare associative array with data from DB. $ doc = \ core_search \ document_factory :: instance ( $ record -> id , $ this -> componentname , $ this -> areaname ) ; // Include all alternate names in title. $ array = [ ] ; foreach ( get_all_user_name_fields ( false , null , null , null , true ) as $ field ) { $ array [ $ field ] = $ record -> $ field ; } $ fullusername = join ( ' ' , $ array ) ; // Assigning properties to our document. $ doc -> set ( 'title' , content_to_text ( $ fullusername , false ) ) ; $ doc -> set ( 'contextid' , $ context -> id ) ; $ doc -> set ( 'courseid' , SITEID ) ; $ doc -> set ( 'itemid' , $ record -> id ) ; $ doc -> set ( 'modified' , $ record -> timemodified ) ; $ doc -> set ( 'owneruserid' , \ core_search \ manager :: NO_OWNER_ID ) ; $ doc -> set ( 'content' , content_to_text ( $ record -> description , $ record -> descriptionformat ) ) ; // Check if this document should be considered new. if ( isset ( $ options [ 'lastindexedtime' ] ) && $ options [ 'lastindexedtime' ] < $ record -> timecreated ) { // If the document was created after the last index time, it must be new. $ doc -> set_is_new ( true ) ; } return $ doc ; }
docstring: Returns document instances for each record in the recordset.
  
  @param \stdClass $record
  @param array $options
  @return \core_search\document
docstring_tokens: Returns document instances for each record in the recordset .