]> BookStack Code Mirror - bookstack/blobdiff - app/Search/SearchOptions.php
Themes: Documented public file serving
[bookstack] / app / Search / SearchOptions.php
index e362a8a015f476a4003dbe9c949156b436971dcd..a6f82029920ee7dd0a0ce1de8416a3498764f11b 100644 (file)
@@ -73,7 +73,7 @@ class SearchOptions
         }
 
         if (isset($inputs['types']) && count($inputs['types']) < 4) {
-            $cleanedFilters[] = new FilterSearchOption(implode('|', $inputs['types']), 'types');
+            $cleanedFilters[] = new FilterSearchOption(implode('|', $inputs['types']), 'type');
         }
 
         $instance->filters = new SearchOptionSet($cleanedFilters);
@@ -235,18 +235,21 @@ class SearchOptions
     {
         $options = [];
 
-        // Non-[created/updated]-by-me options
+        // Handle filters without UI support
         $userFilters = ['updated_by', 'created_by', 'owned_by'];
+        $unsupportedFilters = ['is_template', 'sort_by'];
         foreach ($this->filters->all() as $filter) {
             if (in_array($filter->getKey(), $userFilters, true) && $filter->value !== null && $filter->value !== 'me') {
                 $options[] = $filter;
+            } else if (in_array($filter->getKey(), $unsupportedFilters, true)) {
+                $options[] = $filter;
             }
         }
 
         // Negated items
-        array_push($options, ...$this->exacts->negated());
-        array_push($options, ...$this->tags->negated());
-        array_push($options, ...$this->filters->negated());
+        array_push($options, ...$this->exacts->negated()->all());
+        array_push($options, ...$this->tags->negated()->all());
+        array_push($options, ...$this->filters->negated()->all());
 
         return implode(' ', array_map(fn(SearchOption $o) => $o->toString(), $options));
     }