metacatui icon indicating copy to clipboard operation
metacatui copied to clipboard

Add more operator options for rules with date fields in the Query Builder

Open robyngit opened this issue 5 years ago • 4 comments

Currently, when building a query rule with one of the date fields, a user can only select "is between" as the operator. It would be nice to include options for "is before" (max only) "is after" (min only), and "is in the year" (value only). The behaviour of the date filter model & view need to be updated for this to work. In the mean time, if there's only one operator to choose from, it should be pre-selected.

robyngit avatar Oct 27 '20 13:10 robyngit

I agree with the spirit of this. It strikes me that these are the same operations as >, '<', and '==' for numeric values. Can we just use those rather than making a more complicated list?

mbjones avatar Oct 27 '20 16:10 mbjones

We could just re-use those operators (side note: technically it's and , see https://github.com/DataONEorg/collections-portals-schemas/issues/82). It's also very easy to use date-specific language for date filters, it's defined as a property of the QueryRuleView

robyngit avatar Oct 27 '20 17:10 robyngit

Related to this issue, when a definition dateFilter is built with only one value (just a min, max, or value element), it's not displayed correctly in the Query Builder. See Rule 2 in the randomly generated test portal, destruct23

robyngit avatar Oct 27 '20 17:10 robyngit

I agree that having an is before is after and in the year operators would be nice. However I think the slider we show now is good enough to achieve that result for people who need it (e.g. setting the year slider to 0 to 1990 would effectively be the same as choosing is before 1990), so this can be lower priority

laurenwalker avatar Oct 27 '20 18:10 laurenwalker