Skip to content

Commit

Permalink
feat: add artefact multisearch group management
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdh committed Oct 30, 2024
1 parent 00677d5 commit f0cbf44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ckanext/nhm/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from ckanext.nhm.views.specimen import modify_field_groups as specimen_modify_groups
from ckanext.nhm.views.indexlot import modify_field_groups as indexlot_modify_groups
from ckanext.nhm.views.sample import modify_field_groups as sample_modify_groups
from ckanext.nhm.views.artefact import modify_field_groups as artefact_modify_groups

try:
from ckanext.status.interfaces import IStatus
Expand Down Expand Up @@ -552,6 +553,8 @@ def vds_modify_field_groups(self, resource_ids, field_groups):
indexlot_modify_groups(field_groups)
if helpers.get_sample_resource_id() in resource_ids:
sample_modify_groups(field_groups)
if helpers.get_artefact_resource_id() in resource_ids:
artefact_modify_groups(field_groups)
return field_groups

def datastore_before_convert_basic_query(self, query):
Expand Down
17 changes: 17 additions & 0 deletions ckanext/nhm/views/artefact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def modify_field_groups(field_groups):
"""
Given a FieldGroups object from the vds plugin, force certain field groups to show
in multisearch results and force certain field groups to be ignored and not shown.
:param field_groups: a FieldGroups object
"""
# forces
field_groups.force("artefactName")
field_groups.force("scientificName")
field_groups.force("")
field_groups.force("artefactType")
field_groups.force("associatedMediaCount")
# ignores
field_groups.ignore("created")
field_groups.ignore("modified")
field_groups.ignore("associatedMedia.*")

0 comments on commit f0cbf44

Please sign in to comment.