search: refactor scan_query callers to use split_query.

Refactor to use split_query instead of scan_query to split a query on
spaces. Preparation for refactoring scan_query into something smarter.
This commit is contained in:
evazion
2020-04-18 19:57:58 -05:00
parent d0c68e68c2
commit 7726563733
7 changed files with 17 additions and 13 deletions

View File

@@ -88,8 +88,8 @@ class AliasAndImplicationImporter
all
when :mass_update
all += PostQueryBuilder.scan_query(token[1])
all += PostQueryBuilder.scan_query(token[2])
all += PostQueryBuilder.split_query(token[1])
all += PostQueryBuilder.split_query(token[2])
all
when :change_category

View File

@@ -760,6 +760,10 @@ class PostQueryBuilder
list
end
def split_query(query)
scan_query(query)
end
def normalize_query(query, normalize_aliases: true, sort: true)
tags = scan_query(query.to_s)
tags = tags.map { |t| Tag.normalize_name(t) }

View File

@@ -4,7 +4,7 @@ module PostSets
attr_reader :tag_array, :page, :raw, :random, :post_count, :format
def initialize(tags, page = 1, per_page = nil, raw: false, random: false, format: "html")
@tag_array = PostQueryBuilder.scan_query(tags)
@tag_array = PostQueryBuilder.split_query(tags)
@page = page
@per_page = per_page
@raw = raw.to_s.truthy?