evazion
|
51ba56e8a3
|
Fix #5001: Media assets not searchable through upload records.
Fix this:
https://danbooru.donmai.us/uploads.json?search[media_assets][md5]=b83daa7f1ae7e4127b1befd32f71ba10
failing with an ActiveRecord::StatementInvalid error.
The bug was that for a `has_many through: ...` association, like
`has_many :media_assets, through: :upload_media_assets`, we weren't
joining on the associated table properly so we ended up generating
invalid SQL.
|
2022-02-08 19:18:11 -06:00 |
|
evazion
|
c0f744f84d
|
Fix #4893: Add a FIELD_present parameter variation for text fields.
Usage:
* https://danbooru.donmai.us/wiki_pages.json?search[body_present]=true
* https://danbooru.donmai.us/wiki_pages.json?search[body_present]=false
|
2021-10-13 04:10:23 -05:00 |
|
evazion
|
c1b865b160
|
searchable: add more enum attribute search options.
Add `<enum>_not` and `<enum>_id_<op>` search options:
* https://danbooru.donmai.us/mod_actions?search[category_not]=post_regenerate,post_regenerate_iqdb
* https://danbooru.donmai.us/mod_actions?search[category_not]=48,49
* https://danbooru.donmai.us/mod_actions?search[category_id]=40..50
* https://danbooru.donmai.us/mod_actions?search[category_id_not]=40..50
* https://danbooru.donmai.us/mod_actions?search[category_id_gt]=40&search[category_id_lt]=50
|
2021-01-11 19:13:35 -06:00 |
|
evazion
|
e7b454686e
|
searchable: refactor where_operator method.
Refactor the `where_operator` method so we can use it to avoid raw SQL
in more places.
|
2021-01-11 19:13:29 -06:00 |
|
evazion
|
6d2eeb6f28
|
searchable: fix being unable to use multiple operators on same attribute.
Fix searches like this not working:
* https://danbooru.donmai.us/tags?search[id]=1..100&search[id_not]=50
Before one of these params would override the other.
|
2021-01-11 14:59:04 -06:00 |
|
evazion
|
9759701071
|
search: add way to search array attributes by regex.
Add a `where_any_in_array_matches_regex` method and expose it to the API:
* https://danbooru.donmai.us/artists?search[any_other_name_matches_regex]=^blah
* https://danbooru.donmai.us/wiki_pages?search[any_other_name_matches_regex]=^blah
* https://danbooru.donmai.us/saved_searches?search[any_label_matches_regex]=^blah
In SQL, this does `WHERE '^blah' ~<< ANY(other_names)`, where `~<<` is a
custom operator based on the `~` regex match operator, but with the
arguments reversed. This allows it to be used with the ANY(array) operator.
See also:
* https://stackoverflow.com/a/22101172
* https://www.postgresql.org/docs/current/sql-createfunction.html
* https://www.postgresql.org/docs/current/sql-createoperator.html
* https://www.postgresql.org/docs/current/functions-comparisons.html
|
2021-01-10 02:03:02 -06:00 |
|
evazion
|
da3e8e4726
|
searchable: fix bug with searching multiple association attributes.
Fix a bug with searches like the following not working correctly:
* https://danbooru.donmai.us/comments.json?search[creator][level]=20&search[creator_id]=1234
* https://danbooru.donmai.us/comments.json?search[creator][level]=20&search[creator_name]=abcd
* https://danbooru.donmai.us/comments.json?search[post][rating]=s&search[post_tags_match]=touhou
It wasn't possible to search for both `creator` and `creator_id` at the
same time (or `post` and `post_tags_match`, etc). Only the `creator_id`
param would be recognized.
Also refactor some internals:
* `search_includes` was renamed to `search_associated_attribute`.
* `search_attribute` was split up into `search_basic_attribute` and
`search_associated_attribute`.
|
2021-01-07 17:10:29 -06:00 |
|
evazion
|
b0659eb76c
|
searchable: add tests for Searchable concern.
|
2020-12-16 23:57:04 -06:00 |
|