X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/cd84d08157255dd2464a6dcc257355ffeca21c96..refs/pull/5721/head:/app/Search/SearchOptions.php diff --git a/app/Search/SearchOptions.php b/app/Search/SearchOptions.php index e362a8a01..bf527d9c3 100644 --- a/app/Search/SearchOptions.php +++ b/app/Search/SearchOptions.php @@ -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); @@ -181,7 +181,7 @@ class SearchOptions protected static function parseStandardTermString(string $termString): array { $terms = explode(' ', $termString); - $indexDelimiters = SearchIndex::$delimiters; + $indexDelimiters = implode('', array_diff(str_split(SearchIndex::$delimiters), str_split(SearchIndex::$softDelimiters))); $parsed = [ 'terms' => [], 'exacts' => [], @@ -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)); }