FEATURE: Log Search Queries

This commit is contained in:
Robin Ward
2017-07-13 13:34:31 -04:00
parent 951fd1219d
commit 97e211f837
8 changed files with 256 additions and 10 deletions

View File

@@ -196,6 +196,15 @@ class Search
# Query a term
def execute
if SiteSetting.log_search_queries?
SearchLog.log(
term: @term,
search_type: @opts[:search_type],
ip_address: @opts[:ip_address],
user_id: @opts[:user_id]
)
end
unless @filters.present?
min_length = @opts[:min_search_term_length] || SiteSetting.min_search_term_length
terms = (@term || '').split(/\s(?=(?:[^"]|"[^"]*")*$)/).reject {|t| t.length < min_length }