gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
9 stars 6 forks source link

Exclude datasets in filter #270

Closed T-Engel closed 9 months ago

T-Engel commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to use the dataset filter to exclude specific datasets. For example, I want to include all datasets but "naturgucker".

Describe the solution you'd like A dropdown menu with all datasets so they can be ticked and unticked (might not scale well if many datasets are in the portal)

Describe alternatives you've considered Alternatively, is there a syntax for exclusion that can be used in the current version of the filter? something along the lines of " dataset != naturgucker"

Additional context in the screenshot below, it would be great to see all the available datasets so one can manually select. image

Cheers!

MortenHofft commented 1 year ago

Hi - that isn't possible in the UI currently. The API allows it so it is possible. Could you create a feature request in https://github.com/gbif/hosted-portals/issues please?

MortenHofft commented 9 months ago

This is now in available as an experiment. The UI might change a bit. And we also need to evaluate the performance. Traditionally we have been avoiding negations as they perform bad.

It is possible by providing an overwrite for the individual filters. enum filters and suggest filters support it. Here is an example from hp-land where the dataset filter is extended to support negations https://github.com/gbif/hp-land/blob/97d986c2bd79092ef4ce7409c4fc6e0f589a2cd6/_includes/js/config.js#L72

filters: {
  datasetKey: {
    merge: true, // merge the settings with the already defined dataset filter
    config: {
      specific: {
        supportsNegation: true // the only field that we want to change
      }
    }
  }
}

@T-Engel your site without naturgucker https://land.hp.gbif-staging.org/occurrence/search/?filter=eyJtdXN0X25vdCI6eyJkYXRhc2V0S2V5IjpbIjZhYzNmNzc0LWQ5ZmItNDc5Ni1iM2U5LTkyYmY2YzgxYzA4NCJdfX0%3D

jholetschek commented 8 months ago

This is perfect - and it's also reasonably fast- Thanks, Morten!