Merge branch 'MDL-53515-master' of git://github.com/merrill-oakland/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 29 Mar 2016 06:39:53 +0000 (14:39 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Mar 2016 06:39:53 +0000 (14:39 +0800)
1  2 
lang/en/search.php
search/classes/document.php
search/engine/solr/classes/engine.php
search/engine/solr/tests/engine_test.php
search/templates/result.mustache

Simple merge
@@@ -153,12 -163,24 +163,24 @@@ class document implements \renderable, 
              'indexed' => true
          ),
          'description2' => array(
 -            'type' => 'string',
 +            'type' => 'text',
              'stored' => true,
              'indexed' => true
-         ),
+         )
      );
  
+     /**
+      * Any fields that are engine specifc. These are fields that are solely used by a search engine plugin
+      * for internal purposes.
+      *
+      * Field names should be prefixed with engine name to avoid potential conflict with core fields.
+      *
+      * Uses same format as fields above.
+      *
+      * @var array
+      */
+     protected static $enginefields = array();
      /**
       * We ensure that the document has a unique id across search areas.
       *
                  // Overwrite the timestamp with the engine dependant format.
                  $data[$fieldname] = static::format_time_for_engine($data[$fieldname]);
              } else if ($field['type'] === 'string') {
 -                // Overwrite the timestamp with the engine dependant format.
 +                // 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]);
              }
 +
          }
  
-         foreach (static::$optionalfields as $fieldname => $field) {
+         $fields = static::$optionalfields + static::$enginefields;
+         foreach ($fields as $fieldname => $field) {
              if (!isset($data[$fieldname])) {
                  continue;
              }
Simple merge
Simple merge