Background and strategic fit
Apart from spatial search, in the field of agricultural science temporal aspect plays a critical role. Hence, we needed to add the temporal search for our catalog.
This code is inspired by these sources:
https://github.com/okfn/ckanext-tsbsatellites/blob/master/ckanext/tsbsatellites/plugin.py#L73
https://github.com/okfn/ckanext-tsbsatellites
https://github.com/geosolutions-it/ckanext-datesearch
https://github.com/EUDAT-B2FIND/ckanext-timeline
The important point here is, that this temporal search is only for the content of the catalog entry and not the creation and modification time of that entry in the catalog [creation_date & modification_data which are stored directly by catalog software].
Installations and Requirements
To install ckanext-datesearch on a production site:
Activate your CKAN virtual environment, for example:
ENV /usr/lib/ckan/default/bin/activate
Install the ckanext-datesearch Python package into your virtual environment:
pip install -e 'git+https://github.com/MandanaMoshref/ckanext-datesearch.git#egg=ckanext-datesearch'
Add
datesearch
to theckan.plugins
setting in your CKAN config file.Restart CKAN. For example, if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
Requirements & configuration:
You may need to check you schema.xml to see that this line exists:
<dynamicField name="extras_*" type="text" indexed="true" stored="true" multiValued="false"/>
If you use the default ckan metadata, as the extra field you may add two (or only one of them) attributes (key): "begin-collection_date" and "end-collection_date". In case you use ckanext-scheming, then you need to add these two fields into your schema json file.
User interaction and design
Useful links
Questions and Answers
Below is a list of Q&A from user sides:
Question | Answers |
---|---|
How does the search functionality work? | The user chooses the period of time, in that datasets are collected or generated or manages. The result will include all entries which cover this time period. This means even a dataset which has a wider time range (incl. the search time period) will be chosen. Also, the user can define only start or end date. In this way, whose dataset which have no date will be also chosen. |