0
0
Fork 0

Fix account_id, max_id and min_id params not working in search (#26847)

This commit is contained in:
Eugen Rochko 2023-09-08 14:25:00 +02:00 committed by GitHub
parent e9b528eaee
commit 3a679844e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 7 deletions

View file

@ -225,17 +225,16 @@ class SearchQueryTransformer < Parslet::Transform
rule(clause: subtree(:clause)) do
prefix = clause[:prefix][:term].to_s if clause[:prefix]
operator = clause[:operator]&.to_s
term = clause[:phrase] ? clause[:phrase].map { |term| term[:term].to_s }.join(' ') : clause[:term].to_s
if clause[:prefix] && SUPPORTED_PREFIXES.include?(prefix)
PrefixClause.new(prefix, operator, clause[:term].to_s, current_account: current_account)
PrefixClause.new(prefix, operator, term, current_account: current_account)
elsif clause[:prefix]
TermClause.new(operator, "#{prefix} #{clause[:term]}")
TermClause.new(operator, "#{prefix} #{term}")
elsif clause[:term]
TermClause.new(operator, clause[:term].to_s)
elsif clause[:shortcode]
TermClause.new(operator, ":#{clause[:term]}:")
TermClause.new(operator, term)
elsif clause[:phrase]
PhraseClause.new(operator, clause[:phrase].is_a?(Array) ? clause[:phrase].map { |p| p[:term].to_s }.join(' ') : clause[:phrase].to_s)
PhraseClause.new(operator, term)
else
raise "Unexpected clause type: #{clause}"
end