Closed nimmolo closed 3 months ago
@JoeCohen I added this message at the top of the flash, if there's a has_
term.
We've changed some terms. Please try "with#{thing}" instead of "has#{thing}".
@JoeCohen Thanks for trying it out! It should be pretty easy in the future to make a popup form that will populate these search terms and form the entire search string, so people don't have to type them all out.
I just realized (belatedly) that the pattern search params are no more coupled to the Query params than the API params are. They both go through a step of mapping param: other_param
.
To heck with changing these, let's keep them the same as they currently are. Now if i can just untangle them...
Wrote a script to update the user content_filter
preference strings in the db, replacing has_images
and has_specimen
with with_images
and with_specimen
.
The ContentFilter
stuff maps straight onto Query methods, so these two have to change.
@JoeCohen - the param changes are all now under the hood, not affecting users, except for the three changes to PatternSearch params: images
, specimen
and sequence
.
I understand why these params were abbreviated in the first place: no one is going to search by a specific image id, so images:foo
is theoretically unambiguous, unlike comments:foo
, where the param is describing a searched phrase in the comments, so the boolean has to be has_comments:true
. The same for specimens and sequences (no one is going to search by sequence:DAGDAD
.) Maybe for minimum feather-ruffling, we keep these as is.
But to me, not a PatternSearch power user, i do prefer this change to has_images
, has_specimen
and has_sequence
because all the many other Boolean params have has_
. It seems easier to remember.
Changes
Query
boolean param names fromhas_description
towith_description
, etc., and changes a few model scopes to match. (Mostly, the model scopes are already named likewith_description
.)It's OCD but it gets the params in alignment with the model scopes, which may be useful when refactoring Query to use model scopes. This gets us closer to compliance with a Rubocop rule against
has_xxx
method names. (There's no Rubocop rule againsthas_
as a param name. Of course the scopes could use thehas_
pattern, contra Rubocop, but no need to pile up violations.)In the spirit of standardizing and reducing surprises with these param names, this also adds
has_
to a fewPatternSearch
params that are also boolean, likehas_images
,has_sequences
andhas_specimen
. (formerlyimages
,sequences
, andspecimen
). The rest ofPatternSearch
is left as currently.Implications of this PR:
has_images
,has_specimen
etc. This PR updates the instructions accordingly, on https://mushroomobserver.org/info/search_bar_helphas_specimen
would now map to the Query paramwith_specimen
.