Skip to content

Commit 4fd98bf

Browse files
authored
Merge pull request #423 from plural/add-id-to-search-grammar
Add id operand to search grammar.
2 parents d638f56 + 52f2f01 commit 4fd98bf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/search_query_builder.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ def self.both(field)
216216
FieldData.new(:string, both('stripped_text'), %w[text x],
217217
'The text of a card, stripped of all formatting symbols and marks.'),
218218
FieldData.new(:string, both('stripped_title'), %w[title _],
219-
'The title of a card, stripped of all formatting symbols and marks.')
219+
'The title of a card, stripped of all formatting symbols and marks.'),
220+
FieldData.new(:string, both('id'), %w[id],
221+
'The string id for this type.')
220222
]
221223
# rubocop:enable Layout/LineLength
222224
def self.search_filter_docs
@@ -324,7 +326,7 @@ def initialize(query)
324326
end
325327

326328
# Generate SQL query and parameters from AST
327-
# This has the side effect of adding the SQL parameters to @where_values
329+
# This has the side effect of adding the SQL parameters to @whereues
328330
@where_values = []
329331
# TODO(plural): Capture any exceptions in here and return them as well formatted errors.
330332
@where = transform.apply(@parse_tree).construct_clause(@where_values, fields)
@@ -462,7 +464,7 @@ def construct_clause(parameters, context)
462464

463465
# Booleans
464466
when :boolean
465-
unless %w[true false t f 1 0].include?(value)
467+
unless %w[true false t f 1 0 any].include?(value)
466468
raise format('Invalid value "%<value>s" for boolean field "%<field>s"', value:, field: context.keyword)
467469
end
468470

0 commit comments

Comments
 (0)