dronefly-garden / dronefly

Red Discord Bot V3 cogs for naturalists.
Other
16 stars 3 forks source link

obs: Enable the ability to exclude taxa from search results #107

Open michaelpirrello opened 4 years ago

michaelpirrello commented 4 years ago

Per discussion: e.g. lepidoptera without butterflies; fungi without lichens

synrg commented 4 years ago

This is something that will be more important as we build out support for matching multiple observations instead of returning a single result.

synrg commented 2 years ago

This is partially supported via opt without_taxon_id=# (and can take a comma-delimited list of id#s). I say partially because it is unwieldly for users to lookup and type the id numbers. For the commonly used ones, therefore, Dronefly has some predefined taxonomic group macros (see ,groups for a list).

synrg commented 1 year ago

Adding this to the query language as not rather than without clears up 2 separate issues:

  1. We already use with for annotations. Using without for taxa would just cause confusion.
  2. Negation is not quite the same thing as exclusion. Group macros may contain exclusions, and the meaning of excluding an exclusion is not at all easy!

Example:

Exclusion:

Negation:

This is complicated enough, and also confusing for the user, so that I believe we should just forbid negation with the not keyword of groups that contain negations. If we ever need such a thing, we'd be better off making a new macro for it, like nonwasps.

So my proposal is to support not keyword in the query language, and it can only precede a selector for a single taxon (i.e. not a "group macro").