mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05:00
UX: Revamp quick search (#14499)
Co-authored-by: Robin Ward <robin.ward@gmail.com> Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
co-authored by
Robin Ward
Alan Guo Xiang Tan
parent
98d2836eb4
commit
e9b1d29d8b
+12
-3
@@ -33,7 +33,7 @@ class Search
|
||||
end
|
||||
|
||||
def self.facets
|
||||
%w(topic category user private_messages tags all_topics)
|
||||
%w(topic category user private_messages tags all_topics exclude_topics)
|
||||
end
|
||||
|
||||
def self.ts_config(locale = SiteSetting.default_locale)
|
||||
@@ -230,7 +230,7 @@ class Search
|
||||
end
|
||||
|
||||
def limit
|
||||
if @opts[:type_filter].present?
|
||||
if @opts[:type_filter].present? && @opts[:type_filter] != "exclude_topics"
|
||||
Search.per_filter + 1
|
||||
else
|
||||
Search.per_facet + 1
|
||||
@@ -862,13 +862,13 @@ class Search
|
||||
groups = Group
|
||||
.visible_groups(@guardian.user, "name ASC", include_everyone: false)
|
||||
.where("name ILIKE :term OR full_name ILIKE :term", term: "%#{@term}%")
|
||||
.limit(limit)
|
||||
|
||||
groups.each { |group| @results.add(group) }
|
||||
end
|
||||
|
||||
def tags_search
|
||||
return unless SiteSetting.tagging_enabled
|
||||
|
||||
tags = Tag.includes(:tag_search_data)
|
||||
.where("tag_search_data.search_data @@ #{ts_query}")
|
||||
.references(:tag_search_data)
|
||||
@@ -882,6 +882,15 @@ class Search
|
||||
end
|
||||
end
|
||||
|
||||
def exclude_topics_search
|
||||
if @term.present?
|
||||
user_search
|
||||
category_search
|
||||
tags_search
|
||||
groups_search
|
||||
end
|
||||
end
|
||||
|
||||
PHRASE_MATCH_REGEXP_PATTERN = '"([^"]+)"'
|
||||
|
||||
def posts_query(limit, type_filter: nil, aggregate_search: false)
|
||||
|
||||
@@ -180,6 +180,7 @@ module SvgSprite
|
||||
"sign-in-alt",
|
||||
"sign-out-alt",
|
||||
"signal",
|
||||
"sliders-h",
|
||||
"star",
|
||||
"step-backward",
|
||||
"step-forward",
|
||||
|
||||
Reference in New Issue
Block a user