Skip to content

Commit

Permalink
Merge pull request #1541 from danskernesdigitalebibliotek/DDFFORM-66-…
Browse files Browse the repository at this point in the history
…arrangementsliste-fritekst-sogning

DDFFORM-66 - Add fulltext search to `articles` and `events` views
  • Loading branch information
kasperbirch1 authored Sep 13, 2024
2 parents 50f6dd1 + 5cf34fb commit d9b5991
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 11 deletions.
29 changes: 28 additions & 1 deletion config/sync/search_api.index.content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ dependencies:
- field.storage.node.field_branch
- field.storage.node.field_categories
- field.storage.node.field_publication_date
- field.storage.node.field_subtitle
- field.storage.node.field_teaser_text
- search_api.server.db_search
module:
- node
Expand Down Expand Up @@ -47,6 +49,22 @@ field_settings:
dependencies:
config:
- field.storage.node.field_publication_date
field_subtitle:
label: Subtitle
datasource_id: 'entity:node'
property_path: field_subtitle
type: text
dependencies:
config:
- field.storage.node.field_subtitle
field_teaser_text:
label: 'Teaser text'
datasource_id: 'entity:node'
property_path: field_teaser_text
type: text
dependencies:
config:
- field.storage.node.field_teaser_text
status:
label: Published
datasource_id: 'entity:node'
Expand All @@ -59,7 +77,7 @@ field_settings:
label: Title
datasource_id: 'entity:node'
property_path: title
type: string
type: text
dependencies:
module:
- node
Expand All @@ -84,6 +102,15 @@ processor_settings:
aggregated_field: { }
custom_value: { }
entity_type: { }
ignorecase:
weights:
preprocess_index: -20
preprocess_query: -20
all_fields: false
fields:
- field_subtitle
- title
- type
language_with_fallback: { }
rendered_item: { }
tracker_settings:
Expand Down
24 changes: 24 additions & 0 deletions config/sync/search_api.index.events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ field_settings:
dependencies:
module:
- field_inheritance
event_description:
label: 'Event description'
datasource_id: 'entity:eventinstance'
property_path: event_description
type: text
dependencies:
module:
- field_inheritance
event_tags:
label: 'Event tags'
datasource_id: 'entity:eventinstance'
Expand All @@ -61,6 +69,14 @@ field_settings:
dependencies:
module:
- recurring_events
title:
label: 'Event title'
datasource_id: 'entity:eventinstance'
property_path: title
type: text
dependencies:
module:
- field_inheritance
datasource_settings:
'entity:eventinstance':
bundles:
Expand All @@ -74,6 +90,14 @@ processor_settings:
aggregated_field: { }
custom_value: { }
entity_type: { }
ignorecase:
weights:
preprocess_index: -20
preprocess_query: -20
all_fields: true
fields:
- event_description
- title
language_with_fallback: { }
rendered_item: { }
tracker_settings:
Expand Down
100 changes: 98 additions & 2 deletions config/sync/views.view.articles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies:
- field.storage.node.field_branch
- search_api.index.content
module:
- better_exposed_filters
- search_api
- user
- views_infinite_scroll
Expand Down Expand Up @@ -120,7 +121,7 @@ display:
automatically_load_content: false
initially_load_all_pages: true
exposed_form:
type: basic
type: bef
options:
submit_button: Apply
reset_button: false
Expand All @@ -129,14 +130,55 @@ display:
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
text_input_required: 'Select any filter and click on Apply to see results'
text_input_required_format: basic
bef:
general:
autosubmit: true
autosubmit_exclude_textfield: false
autosubmit_textfield_delay: 500
autosubmit_hide: true
input_required: false
allow_secondary: false
secondary_label: 'Advanced options'
secondary_open: false
reset_button_always_show: false
filter:
search_api_fulltext:
plugin_id: default
advanced:
placeholder_text: ''
rewrite:
filter_rewrite_values: ''
filter_rewrite_values_key: false
collapsible: false
collapsible_disable_automatic_open: false
is_secondary: false
options_show_only_used: false
options_show_only_used_filtered: false
options_hide_when_empty: false
options_show_items_count: false
access:
type: perm
options:
perm: 'access content'
cache:
type: none
options: { }
empty: { }
empty:
area:
id: area
table: views
field: area
relationship: none
group_type: group
admin_label: ''
plugin_id: text
empty: true
content:
value: 'Unfortunately, there were no results for your search. Try using a different search term.'
format: basic
tokenize: false
sorts:
field_publication_date:
id: field_publication_date
Expand Down Expand Up @@ -232,6 +274,58 @@ display:
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
search_api_fulltext:
id: search_api_fulltext
table: search_api_index_content
field: search_api_fulltext
relationship: none
group_type: group
admin_label: ''
plugin_id: search_api_fulltext
operator: and
value: ''
group: 1
exposed: true
expose:
operator_id: search_api_fulltext_op
label: Search
description: ''
use_operator: false
operator: search_api_fulltext_op
operator_limit_selection: false
operator_list: { }
identifier: search_api_fulltext
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
local_administrator: '0'
editor: '0'
mediator: '0'
patron: '0'
external_system: '0'
expose_fields: false
placeholder: Søg
searched_fields_id: search_api_fulltext_searched_fields
value_maxlength: 128
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
parse_mode: terms
min_length: null
fields: { }
style:
type: default
row:
Expand Down Expand Up @@ -259,6 +353,7 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
Expand All @@ -279,6 +374,7 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- 'user.node_grants:view'
- user.permissions
Expand Down
71 changes: 69 additions & 2 deletions config/sync/views.view.events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,20 @@ display:
cache:
type: none
options: { }
empty: { }
empty:
area:
id: area
table: views
field: area
relationship: none
group_type: group
admin_label: ''
plugin_id: text
empty: true
content:
value: 'Unfortunately, there were no results for your search. Try using a different search term.'
format: basic
tokenize: false
sorts:
date:
id: date
Expand Down Expand Up @@ -261,6 +274,58 @@ display:
default_group: All
default_group_multiple: { }
group_items: { }
search_api_fulltext:
id: search_api_fulltext
table: search_api_index_events
field: search_api_fulltext
relationship: none
group_type: group
admin_label: ''
plugin_id: search_api_fulltext
operator: and
value: ''
group: 1
exposed: true
expose:
operator_id: search_api_fulltext_op
label: Search
description: ''
use_operator: false
operator: search_api_fulltext_op
operator_limit_selection: false
operator_list: { }
identifier: search_api_fulltext
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
local_administrator: '0'
editor: '0'
mediator: '0'
patron: '0'
external_system: '0'
expose_fields: false
placeholder: Søg
searched_fields_id: search_api_fulltext_searched_fields
value_maxlength: 128
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
parse_mode: terms
min_length: null
fields: { }
style:
type: default
row:
Expand All @@ -277,14 +342,15 @@ display:
preserve_facet_query_args: false
query_tags: { }
relationships: { }
use_ajax: true
use_ajax: false
header: { }
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- user.permissions
tags:
Expand All @@ -305,6 +371,7 @@ display:
max-age: -1
contexts:
- 'languages:language_interface'
- url
- url.query_args
- user.permissions
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form class="header__menu-search" action="{{ url(form_route) }}">
<label class="hide-visually">{{ 'Search content'|trans }}</label>
<input required value="{{ default_input }}" name="search" class="header__menu-search-input text-body-medium-regular" type="text" placeholder="{{ 'Search the website'|trans }}" aria-label="{{ 'Search the website'|trans }}" aria-activedescendant aria-expanded="false" autocomplete="off">
<input alt="{{ 'Search button'|trans }}" class="header__menu-search-icon"
<input alt="{{ 'Search'|trans }}" class="header__menu-search-icon"
type="image" src="data:image/svg+xml,%3csvg width='24' height='24' viewBox='-2 -2 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.5 0C13.1944 0 17 3.80558 17 8.5C17 10.5772 16.2549 12.4804 15.0173 13.9569L19.5303 18.4697C19.8232 18.7626 19.8232 19.2374 19.5303 19.5303C19.2641 19.7966 18.8474 19.8208 18.5538 19.6029L18.4697 19.5303L13.9569 15.0173C12.4804 16.2549 10.5772 17 8.5 17C3.80558 17 0 13.1944 0 8.5C0 3.80558 3.80558 0 8.5 0ZM8.5 1.5C4.63401 1.5 1.5 4.63401 1.5 8.5C1.5 12.366 4.63401 15.5 8.5 15.5C12.366 15.5 15.5 12.366 15.5 8.5C15.5 4.63401 12.366 1.5 8.5 1.5Z' fill='black'/%3e %3c/svg%3e">
</form>
</div>
Loading

0 comments on commit d9b5991

Please sign in to comment.