MDL-55190 search: Limit search to non-files if disabled
authorEric Merrill <merrill@oakland.edu>
Wed, 13 Jul 2016 10:05:33 +0000 (06:05 -0400)
committerEric Merrill <merrill@oakland.edu>
Wed, 13 Jul 2016 10:05:33 +0000 (06:05 -0400)
search/engine/solr/classes/engine.php

index 05a1ae6..ce2f722 100644 (file)
@@ -316,6 +316,9 @@ class engine extends \core_search\engine {
             $query->setGroupLimit(3);
             $query->setGroupNGroups(true);
             $query->addGroupField('solr_filegroupingid');
+        } else {
+            // Make sure we only get text files, in case the index has pre-existing files.
+            $query->addFilterQuery('type:'.\core_search\manager::TYPE_TEXT);
         }
 
         return $query;