original_string: public function export_for_engine() {
          // Set any unset defaults.
          $this->apply_defaults();
  
          // We don't want to affect the document instance.
          $data = $this->data;
  
          // Apply specific engine-dependant formats and restrictions.
          foreach (static::$requiredfields as $fieldname => $field) {
  
              // We also check that we have everything we need.
              if (!isset($data[$fieldname])) {
                  throw new \coding_exception('Missing "' . $fieldname . '" field in document with id "' . $this->data['id'] . '"');
              }
  
              if ($field['type'] === 'tdate') {
                  // Overwrite the timestamp with the engine dependant format.
                  $data[$fieldname] = static::format_time_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'string') {
                  // Overwrite the string with the engine dependant format.
                  $data[$fieldname] = static::format_string_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'text') {
                  // Overwrite the text with the engine dependant format.
                  $data[$fieldname] = static::format_text_for_engine($data[$fieldname]);
              }
  
          }
  
          $fields = static::$optionalfields + static::$enginefields;
          foreach ($fields as $fieldname => $field) {
              if (!isset($data[$fieldname])) {
                  continue;
              }
              if ($field['type'] === 'tdate') {
                  // Overwrite the timestamp with the engine dependant format.
                  $data[$fieldname] = static::format_time_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'string') {
                  // Overwrite the string with the engine dependant format.
                  $data[$fieldname] = static::format_string_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'text') {
                  // Overwrite the text with the engine dependant format.
                  $data[$fieldname] = static::format_text_for_engine($data[$fieldname]);
              }
          }
  
          return $data;
      }
code: public function export_for_engine() {
          // Set any unset defaults.
          $this->apply_defaults();
  
          // We don't want to affect the document instance.
          $data = $this->data;
  
          // Apply specific engine-dependant formats and restrictions.
          foreach (static::$requiredfields as $fieldname => $field) {
  
              // We also check that we have everything we need.
              if (!isset($data[$fieldname])) {
                  throw new \coding_exception('Missing "' . $fieldname . '" field in document with id "' . $this->data['id'] . '"');
              }
  
              if ($field['type'] === 'tdate') {
                  // Overwrite the timestamp with the engine dependant format.
                  $data[$fieldname] = static::format_time_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'string') {
                  // Overwrite the string with the engine dependant format.
                  $data[$fieldname] = static::format_string_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'text') {
                  // Overwrite the text with the engine dependant format.
                  $data[$fieldname] = static::format_text_for_engine($data[$fieldname]);
              }
  
          }
  
          $fields = static::$optionalfields + static::$enginefields;
          foreach ($fields as $fieldname => $field) {
              if (!isset($data[$fieldname])) {
                  continue;
              }
              if ($field['type'] === 'tdate') {
                  // Overwrite the timestamp with the engine dependant format.
                  $data[$fieldname] = static::format_time_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'string') {
                  // Overwrite the string with the engine dependant format.
                  $data[$fieldname] = static::format_string_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'text') {
                  // Overwrite the text with the engine dependant format.
                  $data[$fieldname] = static::format_text_for_engine($data[$fieldname]);
              }
          }
  
          return $data;
      }
code_tokens: public function export_for_engine ( ) { // Set any unset defaults. $ this -> apply_defaults ( ) ; // We don't want to affect the document instance. $ data = $ this -> data ; // Apply specific engine-dependant formats and restrictions. foreach ( static :: $ requiredfields as $ fieldname => $ field ) { // We also check that we have everything we need. if ( ! isset ( $ data [ $ fieldname ] ) ) { throw new \ coding_exception ( 'Missing "' . $ fieldname . '" field in document with id "' . $ this -> data [ 'id' ] . '"' ) ; } if ( $ field [ 'type' ] === 'tdate' ) { // Overwrite the timestamp with the engine dependant format. $ data [ $ fieldname ] = static :: format_time_for_engine ( $ data [ $ fieldname ] ) ; } else if ( $ field [ 'type' ] === 'string' ) { // Overwrite the string with the engine dependant format. $ data [ $ fieldname ] = static :: format_string_for_engine ( $ data [ $ fieldname ] ) ; } else if ( $ field [ 'type' ] === 'text' ) { // Overwrite the text with the engine dependant format. $ data [ $ fieldname ] = static :: format_text_for_engine ( $ data [ $ fieldname ] ) ; } } $ fields = static :: $ optionalfields + static :: $ enginefields ; foreach ( $ fields as $ fieldname => $ field ) { if ( ! isset ( $ data [ $ fieldname ] ) ) { continue ; } if ( $ field [ 'type' ] === 'tdate' ) { // Overwrite the timestamp with the engine dependant format. $ data [ $ fieldname ] = static :: format_time_for_engine ( $ data [ $ fieldname ] ) ; } else if ( $ field [ 'type' ] === 'string' ) { // Overwrite the string with the engine dependant format. $ data [ $ fieldname ] = static :: format_string_for_engine ( $ data [ $ fieldname ] ) ; } else if ( $ field [ 'type' ] === 'text' ) { // Overwrite the text with the engine dependant format. $ data [ $ fieldname ] = static :: format_text_for_engine ( $ data [ $ fieldname ] ) ; } } return $ data ; }
docstring: Returns the document ready to submit to the search engine.
  
  @throws \coding_exception
  @return array
docstring_tokens: Returns the document ready to submit to the search engine .