Skip to content

Commit

Permalink
Add metadata templates search functionality
Browse files Browse the repository at this point in the history
This commit adds the functionality to search for metadata templates using a search identifier. The search identifier is set to "*iepnb-plantilla*" in the .env.example file. This feature is implemented in the ckanext-schemingdcat extension.

- Also add keywords_iepnb to Solr schema

Related issue: mjanez#65
  • Loading branch information
mjanez committed Jun 13, 2024
1 parent 9c0062e commit b67b642
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ CKANEXT__SCHEMINGDCAT_ORGANIZATION_CUSTOM_FACETS=True
CKANEXT__SCHEMINGDCAT_GROUP_CUSTOM_FACETS=True
CKANEXT__SCHEMINGDCAT_DEFAULT_PACKAGE_ITEM_ICON="theme"
CKANEXT__SCHEMINGDCAT_DEFAULT_PACKAGE_ITEM_SHOW_SPATIAL=True
CKANEXT__SCHEMINGDCAT_SHOW_METADATA_TEMPLATES_TOOLBAR=True
CKANEXT__METADATA_TEMPLATES_SEARCH_IDENTIFIER="*iepnb-plantilla*"

# ckanext-pages
CKANEXT__PAGES__ALOW_HTML=False
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,25 @@ See [CKAN Images](#ckan-images) for more details of what happens when using deve
#### Create an extension
You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output:

docker compose -f docker compose.dev.yml exec ckan-dev /bin/sh -c "ckan generate extension --output-dir /srv/app/src_extensions"

![extension](https://user-images.githubusercontent.com/54408245/220623568-b4e074c7-6d07-4d27-ae29-35ce70961463.png)


The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container. You might need to change the owner of its folder to have the appropiate permissions.

##### Running HTTPS on development mode

Sometimes is useful to run your local development instance under HTTPS, for instance if you are using authentication extensions like [ckanext-saml2auth](https://github.com/keitaroinc/ckanext-saml2auth). To enable it, set the following in your `.env` file:

USE_HTTPS_FOR_DEV=true
```bash
docker compose -f docker-compose.dev.yml exec ckan-dev /bin/sh -c "ckan -c /srv/app/ckan.ini generate extension --output-dir /srv/app/src_extensions"
```

and update the site URL setting:
Then, answer the prompts to configure the plugin:

CKAN_SITE_URL=https://localhost:5000
```bash
Extension's name [must begin 'ckanext-']: ckanext-newextension
Author's name []: Joe Bloggs
Author's email []: joe@bloggs.com
Your Github user or organization name []: joebloggs
Brief description of the project []: test creating a new extension
List of keywords (separated by spaces) [CKAN]: ckanext-newextension
Do you want to include code examples? [y/N]: y
Written: /srv/app/src_extensions/ckanext-newextension
```
After recreating the `ckan-dev` container, you should be able to access CKAN at https://localhost:5000
The new extension files and directories are created in the `/srv/app/src_extensions/` folder in the running container. They will also exist in the local src/ directory as local `/src` directory is mounted as `/srv/app/src_extensions/` on the ckan container. You might need to change the owner of its folder to have the appropiate permissions.
## CKAN images
![CKAN Docker Platform](/doc/img/ckan-docker-images.png)
Expand Down
4 changes: 3 additions & 1 deletion ckan/docker-entrypoint.d/02_setup_scheming.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ ckan config-tool $CKAN_INI \
"schemingdcat.group_custom_facets=$CKANEXT__SCHEMINGDCAT_GROUP_CUSTOM_FACETS" \
"schemingdcat.geometadata_base_uri=$CKANEXT__SCHEMINGDCAT_GEOMETADATA_BASE_URI" \
"schemingdcat.default_package_item_icon=$CKANEXT__SCHEMINGDCAT_DEFAULT_PACKAGE_ITEM_ICON" \
"schemingdcat.default_package_item_show_spatial=$CKANEXT__SCHEMINGDCAT_DEFAULT_PACKAGE_ITEM_SHOW_SPATIAL"
"schemingdcat.default_package_item_show_spatial=$CKANEXT__SCHEMINGDCAT_DEFAULT_PACKAGE_ITEM_SHOW_SPATIAL" \
"schemingdcat.show_metadata_templates_toolbar=$CKANEXT__SCHEMINGDCAT_SHOW_METADATA_TEMPLATES_TOOLBAR" \
"schemingdcat.metadata_templates_search_identifier=$CKANEXT__METADATA_TEMPLATES_SEARCH_IDENTIFIER"

echo "[docker-entrypoint.02_setup_scheming] Rebuild index"
ckan -c $CKAN_INI search-index rebuild
2 changes: 1 addition & 1 deletion solr/Dockerfile.iepnb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ENV SOLR_BBOX_FIELDS '<field name="bbox_area" type="float" indexed="true" stored
<field name="reference" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="theme" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="theme_es" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="keywords_iepnb" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="keyword_iepnb" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="resource_relation" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/> \
<field name="metadata_profile" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/>' \
'<field name="dcat_type" type="string" uninvertible="false" docValues="true" indexed="true" stored="true" multiValued="true"/>' \
Expand Down

0 comments on commit b67b642

Please sign in to comment.