Skip to content

Commit 05adf48

Browse files
authored
Merge pull request #143 from distributive/main
Added some missing shortcuts for backwards compatibility
2 parents 360bbd9 + 0ff7eb6 commit 05adf48

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/search_query_builder.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ def self.both(field)
2828
@@search_filter_docs = <<-EOM
2929
#### Notes
3030
31-
The search syntax is the same between the `Card` and `Printing` endpoints aside from some fields that only exist in one or the other.
31+
The search syntax is the same between the `Card` and `Printing` endpoints aside from some fields that only exist in one or the other.
3232
33-
In constructed URLs for calls to the API, ensure that you URL Encode the value to the `filter[search]` argument.
33+
In constructed URLs for calls to the API, ensure that you URL Encode the value to the `filter[search]` argument.
3434
3535
#### Search Query Structure
3636
3737
* A search query is a series of one or more conditions separated by one or more spaces (which acts as an implicit `and`) or explicit conjuctions (`and` and `or`):
3838
* `condition1 condition2 condition3` - gets all cards that meet the requirements of all three conditions
39-
* Multiple values for a given term can be provided with `|` ( acts as `or`) or `&`.
40-
* `text:"Runner is tagged"&meat` will return all cards with both `Runner is tagged` and `meat` in their text.
39+
* Multiple values for a given term can be provided with `|` ( acts as `or`) or `&`.
40+
* `text:"Runner is tagged"&meat` will return all cards with both `Runner is tagged` and `meat` in their text.
4141
* `text:"Runner is tagged"|meat` will return all cards with either `Runner is tagged` or `meat` in their text.
4242
* Each condition must be some or all of the name of a card or a criteria search:
4343
* `Street` - gets all cards with "Street" in their name
@@ -61,7 +61,7 @@ def self.both(field)
6161
There are 5 types of fields in the Search Filter:
6262
6363
* **Array** - supports the `:` (an element in the array is an exact match) and `!` (an element in the array is not an exact match) operators.
64-
* `card_pool_ids:eternal|snapshot` returns all cards in the eternal or snapshot card pools.
64+
* `card_pool_ids:eternal|snapshot` returns all cards in the eternal or snapshot card pools.
6565
* `card_pool!snapshot` returns all cards not in the snapshot card pool.
6666
* **Boolean** - supports the `:` (match) and `!` (negated match) operators. `true`, `false`, `t`, `f`, `1`, and `0` are all acceptable values.
6767
* `advanceable:true`, `advanceable:t`, and `advanceable:1` will all return all results where advanceable is true.
@@ -81,13 +81,13 @@ def self.both(field)
8181
# Note: this does not yet have arrays of name fields supported due to complications with
8282
# needing to UNNEST array fields to handle LIKE queries for array field elements.
8383
@@full_fields = [
84-
FieldData.new(:array, card('card_cycle_ids'), ['card_cycle'],
84+
FieldData.new(:array, card('card_cycle_ids'), ['card_cycle', 'c'],
8585
'`card_cycle_id`s for printings of a card.'),
8686
FieldData.new(:array, both('card_pool_ids'), ['card_pool'],
8787
'`card_pool_id`s for a card pool containing a card.'),
88-
FieldData.new(:array, card('card_set_ids'), ['card_set'],
88+
FieldData.new(:array, card('card_set_ids'), ['card_set', 'e'],
8989
'`card_set_id` for a card, pulled in via printing.'),
90-
FieldData.new(:array, both('lower_card_subtype_names'), ['card_subtype'],
90+
FieldData.new(:array, both('lower_card_subtype_names'), ['card_subtype', 's'],
9191
'text names for card subtypes, matched as lowercase.'),
9292
FieldData.new(:array, both('card_subtype_ids'), ['card_subtype_id'],
9393
'`card_subtype_id`s for the card.'),
@@ -105,7 +105,7 @@ def self.both(field)
105105
'`restriction_id` specifying the card as banned, like `is_restricted:standard_mwl_3_4_b`.'),
106106
FieldData.new(:array, card('printing_ids'), ['printing_id'],
107107
'`printing_id` for any printing of this card.'),
108-
FieldData.new(:array, both('restriction_ids'), ['restriction_id'],
108+
FieldData.new(:array, both('restriction_ids'), ['restriction_id', 'b'],
109109
'`restriction_id` specifying the card for any reason, like: `restriction_id:eternal_points_list_22_09`'),
110110
FieldData.new(:array, both('snapshot_ids'), ['snapshot'],
111111
'`snapshot_id` of a snapshot containing a card.'),
@@ -165,14 +165,12 @@ def self.both(field)
165165
'The trash cost of this card.'),
166166
FieldData.new(:string, both('attribution'), ['attribution'],
167167
'The designer of this card text, if specified.'),
168-
FieldData.new(:array, printing('card_cycle_id'), ['card_cycle'],
168+
FieldData.new(:array, printing('card_cycle_id'), ['card_cycle', 'c'],
169169
'`card_cycle_id` for a printing.'),
170170
FieldData.new(:array, printing('card_id'), ['card_id'],
171171
'`card_id` for a printing.'),
172-
FieldData.new(:array, printing('card_set_id'), ['card_set'],
172+
FieldData.new(:array, printing('card_set_id'), ['card_set', 'e'],
173173
'`card_set_id` for printing.'),
174-
FieldData.new(:string, printing('card_type_id'), ['card_type', 't'],
175-
'`card_type_id` of this card.'),
176174
FieldData.new(:string, both('card_type_id'), ['card_type', 't'],
177175
'`card_type_id` of this card.'),
178176
FieldData.new(:string, both('faction_id'), ['faction', 'f'],

0 commit comments

Comments
 (0)