-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a search page using Drupal views (#4060)
- Loading branch information
1 parent
1aa56a6
commit c7eb1ac
Showing
20 changed files
with
1,035 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
DKAN Search | ||
=========== | ||
|
||
If you plan to build your data site with a Drupal theme rather than a decoupled frontend the metastore_search module provides a dataset search view that you can use as a starting point. | ||
|
||
.. include:: ../../../modules/metastore/modules/metastore_facets/README.md | ||
:parser: myst_parser.docutils_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Metastore Facets | ||
|
||
This is an optional module for sites that are not using a decoupled frontend. It provides example Categories, Tags, and Publishers facet blocks that you can use with the *dkan_dataset_search* view. | ||
|
||
drush en metastore_facets | ||
|
||
Use the block layout screen at /admin/structure/block, and place the facets into a sidebar region, restrict the display to the /dataset-search page only. | ||
|
||
If you do not see the dataset search view, you will need to run the following to get the view and facets working: | ||
|
||
composer require drupal/facets:3.0.x-dev | ||
|
||
drush en metastore_facets | ||
|
||
drush cim --partial --source=modules/contrib/dkan/modules/metastore/modules/metastore_search/config/install | ||
|
||
<aside class="admonition warning"> | ||
<p class="admonition-title">Existing sites be very careful here</p> | ||
<p>This config import will import the search view as well as new search API config. If you have custom search api configuration be sure to have it exported to code for safe keeping.</p> | ||
</aside> | ||
|
||
The search view and facets are for demonstration purposes and provide a starting step for your own implementation. |
75 changes: 75 additions & 0 deletions
75
modules/metastore/modules/metastore_facets/config/install/facets.facet.categories.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- search_api.index.dkan | ||
- views.view.dkan_dataset_search | ||
module: | ||
- search_api | ||
_core: | ||
default_config_hash: 24nvP8tTnc1gmRfiaIIsRgxR-oXY1zDc8vSeTnenU0k | ||
id: categories | ||
name: Categories | ||
url_alias: theme | ||
weight: 0 | ||
min_count: 1 | ||
missing: false | ||
missing_label: others | ||
show_only_one_result: false | ||
field_identifier: theme | ||
facet_source_id: 'search_api:views_page__dkan_dataset_search__dataset_search' | ||
widget: | ||
type: checkbox | ||
config: | ||
show_numbers: true | ||
soft_limit: 0 | ||
show_reset_link: true | ||
reset_text: 'Show all' | ||
hide_reset_when_no_selection: true | ||
soft_limit_settings: | ||
show_less_label: 'Show less' | ||
show_more_label: 'Show more' | ||
query_operator: and | ||
use_hierarchy: false | ||
keep_hierarchy_parents_active: false | ||
hierarchy: | ||
type: taxonomy | ||
config: { } | ||
expand_hierarchy: false | ||
enable_parent_when_child_gets_disabled: true | ||
hard_limit: 0 | ||
exclude: false | ||
only_visible_when_facet_source_is_visible: true | ||
processor_configs: | ||
active_widget_order: | ||
processor_id: active_widget_order | ||
weights: | ||
sort: 20 | ||
settings: | ||
sort: DESC | ||
count_widget_order: | ||
processor_id: count_widget_order | ||
weights: | ||
sort: 30 | ||
settings: | ||
sort: DESC | ||
display_value_widget_order: | ||
processor_id: display_value_widget_order | ||
weights: | ||
sort: 40 | ||
settings: | ||
sort: ASC | ||
hierarchy_processor: | ||
processor_id: hierarchy_processor | ||
weights: | ||
build: 100 | ||
settings: { } | ||
url_processor_handler: | ||
processor_id: url_processor_handler | ||
weights: | ||
pre_query: 50 | ||
build: 15 | ||
settings: { } | ||
empty_behavior: | ||
behavior: none | ||
show_title: false |
73 changes: 73 additions & 0 deletions
73
modules/metastore/modules/metastore_facets/config/install/facets.facet.publishers.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- search_api.index.dkan | ||
- views.view.dkan_dataset_search | ||
module: | ||
- search_api | ||
id: publishers | ||
name: Publishers | ||
weight: 0 | ||
min_count: 1 | ||
missing: false | ||
missing_label: others | ||
url_alias: publishers | ||
facet_source_id: 'search_api:views_page__dkan_dataset_search__dataset_search' | ||
field_identifier: publisher__name | ||
query_operator: and | ||
hard_limit: 0 | ||
exclude: false | ||
use_hierarchy: false | ||
keep_hierarchy_parents_active: false | ||
hierarchy: | ||
type: taxonomy | ||
config: { } | ||
expand_hierarchy: false | ||
enable_parent_when_child_gets_disabled: true | ||
widget: | ||
type: checkbox | ||
config: | ||
show_numbers: true | ||
soft_limit: 0 | ||
show_reset_link: true | ||
reset_text: 'Show all' | ||
hide_reset_when_no_selection: false | ||
soft_limit_settings: | ||
show_less_label: 'Show less' | ||
show_more_label: 'Show more' | ||
empty_behavior: | ||
behavior: none | ||
only_visible_when_facet_source_is_visible: true | ||
show_only_one_result: false | ||
show_title: false | ||
processor_configs: | ||
active_widget_order: | ||
processor_id: active_widget_order | ||
weights: | ||
sort: 20 | ||
settings: | ||
sort: DESC | ||
count_widget_order: | ||
processor_id: count_widget_order | ||
weights: | ||
sort: 30 | ||
settings: | ||
sort: DESC | ||
display_value_widget_order: | ||
processor_id: display_value_widget_order | ||
weights: | ||
sort: 40 | ||
settings: | ||
sort: ASC | ||
hierarchy_processor: | ||
processor_id: hierarchy_processor | ||
weights: | ||
build: 100 | ||
settings: { } | ||
url_processor_handler: | ||
processor_id: url_processor_handler | ||
weights: | ||
pre_query: 50 | ||
build: 15 | ||
settings: { } |
75 changes: 75 additions & 0 deletions
75
modules/metastore/modules/metastore_facets/config/install/facets.facet.tags.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- search_api.index.dkan | ||
- views.view.dkan_dataset_search | ||
module: | ||
- search_api | ||
_core: | ||
default_config_hash: 5l9y65p885oRNMqrRRM4GHCPi8QjjR73QdW86S7hNao | ||
id: tags | ||
name: Tags | ||
url_alias: tags | ||
weight: 0 | ||
min_count: 1 | ||
missing: false | ||
missing_label: others | ||
show_only_one_result: false | ||
field_identifier: keyword | ||
facet_source_id: 'search_api:views_page__dkan_dataset_search__dataset_search' | ||
widget: | ||
type: checkbox | ||
config: | ||
show_numbers: true | ||
soft_limit: 0 | ||
show_reset_link: true | ||
reset_text: 'Show all' | ||
hide_reset_when_no_selection: false | ||
soft_limit_settings: | ||
show_less_label: 'Show less' | ||
show_more_label: 'Show more' | ||
query_operator: and | ||
use_hierarchy: false | ||
keep_hierarchy_parents_active: false | ||
hierarchy: | ||
type: taxonomy | ||
config: { } | ||
expand_hierarchy: false | ||
enable_parent_when_child_gets_disabled: true | ||
hard_limit: 0 | ||
exclude: false | ||
only_visible_when_facet_source_is_visible: true | ||
processor_configs: | ||
active_widget_order: | ||
processor_id: active_widget_order | ||
weights: | ||
sort: 20 | ||
settings: | ||
sort: DESC | ||
count_widget_order: | ||
processor_id: count_widget_order | ||
weights: | ||
sort: 30 | ||
settings: | ||
sort: DESC | ||
display_value_widget_order: | ||
processor_id: display_value_widget_order | ||
weights: | ||
sort: 40 | ||
settings: | ||
sort: ASC | ||
hierarchy_processor: | ||
processor_id: hierarchy_processor | ||
weights: | ||
build: 100 | ||
settings: { } | ||
url_processor_handler: | ||
processor_id: url_processor_handler | ||
weights: | ||
pre_query: 50 | ||
build: 15 | ||
settings: { } | ||
empty_behavior: | ||
behavior: none | ||
show_title: false |
8 changes: 8 additions & 0 deletions
8
...stall/facets.facet_source.search_api__views_page__dkan_dataset_search__dataset_search.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
langcode: en | ||
status: true | ||
dependencies: { } | ||
id: search_api__views_page__dkan_dataset_search__dataset_search | ||
name: 'search_api:views_page__dkan_dataset_search__dataset_search' | ||
filter_key: null | ||
url_processor: query_string | ||
breadcrumb: { } |
8 changes: 8 additions & 0 deletions
8
modules/metastore/modules/metastore_facets/metastore_facets.info.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: DKAN Metastore Facets | ||
description: Provides facet blocks for DKAN Metastore Search. | ||
type: module | ||
core_version_requirement: ^9.4 || ^10 | ||
dependencies: | ||
- dkan:metastore_search | ||
- drupal:facets | ||
package: DKAN |
5 changes: 5 additions & 0 deletions
5
modules/metastore/modules/metastore_facets/metastore_facets.libraries.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
search_facets: | ||
version: 1.0 | ||
css: | ||
theme: | ||
css/metastore_facets.css: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.