Add supported operator and properties for search

This commit is contained in:
noellabo 2023-09-21 17:53:51 +09:00
parent 828eebad48
commit 04ad5e67d0

View file

@ -12,6 +12,23 @@ class SearchQueryTransformer < Parslet::Transform
in
).freeze
SUPPORTED_OPERATOR = %w(
+
-
).freeze
SUPPORTED_PROPERTIES = %w(
image
video
audio
media
poll
link
embed
sensitive
reply
).freeze
class Query
def initialize(clauses, options = {})
raise ArgumentError if options[:current_account].nil?
@ -152,6 +169,8 @@ class SearchQueryTransformer < Parslet::Transform
case prefix
when 'has', 'is'
raise "Unknown properties: #{term}" unless SUPPORTED_PROPERTIES.include?(term)
@filter = :properties
@type = :term
@term = term