MDL-55190 search: Limit search to non-files if disabled
[moodle.git] / 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;