diff --git a/apps/cms/composer.json b/apps/cms/composer.json index 7335cd3c2..51e90bdc6 100644 --- a/apps/cms/composer.json +++ b/apps/cms/composer.json @@ -46,6 +46,7 @@ "amazeelabs/silverback_translations": "^1.0.4", "composer/installers": "^2.2", "drupal/admin_toolbar": "^3.4.1", + "drupal/coffee": "^1.4", "drupal/config_filter": "*", "drupal/config_ignore": "^3.2", "drupal/config_notify": "^1.10", @@ -72,6 +73,7 @@ "drupal/replicate_ui": "^1.1", "drupal/reroute_email": "^2.2", "drupal/role_delegation": "^1.2", + "drupal/search_api": "^1.35", "drupal/simple_oauth": "^5.2", "drupal/slack": "^1.4", "drupal/stage_file_proxy": "^2.0.2", @@ -110,6 +112,9 @@ }, "drupal/graphql": { "Check if translation exists when loading an entity by its uuid": "./patches/graphql_load_by_uuid_translation_check.patch" + }, + "drupal/coffee": { + "On the fly ajax search POC": "./patches/contrib/coffee/on_the_fly_ajax_search_poc.patch" } }, "patchLevel": { diff --git a/apps/cms/composer.lock b/apps/cms/composer.lock index f4ae2c55c..2b0634a5f 100644 --- a/apps/cms/composer.lock +++ b/apps/cms/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3105a4891946236dd438f480f35ec788", + "content-hash": "019cf14605e72c1d5e3a56f7ea16d856", "packages": [ { "name": "amazeeio/drupal_integrations", @@ -2159,6 +2159,76 @@ "issues": "https://www.drupal.org/project/issues/admin_toolbar" } }, + { + "name": "drupal/coffee", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/coffee.git", + "reference": "8.x-1.4" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/coffee-8.x-1.4.zip", + "reference": "8.x-1.4", + "shasum": "9e32a5890d42a2a0312635bd5e3bf91cc2aa07ce" + }, + "require": { + "drupal/core": "^9.2 || ^10" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.4", + "datestamp": "1709147080", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "branch-alias": { + "dev-8.x-1.x": "8.1.x-dev" + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Michael Mol", + "homepage": "https://www.drupal.org/u/michaelmol", + "role": "Maintainer" + }, + { + "name": "Marco", + "homepage": "https://www.drupal.org/u/willzyx", + "role": "Maintainer" + }, + { + "name": "Oliver Köhler", + "homepage": "https://www.drupal.org/u/nebel54", + "role": "Maintainer" + }, + { + "name": "Alli Price", + "homepage": "https://www.drupal.org/u/heylookalive", + "role": "Maintainer" + }, + { + "name": "See other contributors", + "homepage": "https://www.drupal.org/node/1356930/committers", + "role": "contributor" + } + ], + "description": "Provides an Alfred like search box to navigate within your site.", + "homepage": "https://drupal.org/project/coffee", + "support": { + "source": "https://git.drupalcode.org/project/coffee", + "issues": "https://drupal.org/project/issues/coffee", + "irc": "irc://irc.freenode.org/drupal-contribute" + } + }, { "name": "drupal/config_filter", "version": "2.6.0", @@ -4396,6 +4466,78 @@ "issues": "http://drupal.org/project/role_delegation" } }, + { + "name": "drupal/search_api", + "version": "1.35.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/search_api.git", + "reference": "8.x-1.35" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/search_api-8.x-1.35.zip", + "reference": "8.x-1.35", + "shasum": "d119726e870f793c6470d2a4fa9286662c5eb45d" + }, + "require": { + "drupal/core": "^10.1 || ^11" + }, + "conflict": { + "drupal/search_api_solr": "2.* || 3.0 || 3.1" + }, + "require-dev": { + "drupal/language_fallback_fix": "@dev", + "drupal/search_api_autocomplete": "@dev", + "drupal/search_api_db": "*" + }, + "suggest": { + "drupal/facets": "Adds the ability to create faceted searches.", + "drupal/search_api_autocomplete": "Allows adding autocomplete suggestions to search fields.", + "drupal/search_api_solr": "Adds support for using Apache Solr as a backend." + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.35", + "datestamp": "1718551025", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^9 || ^10 || ^11" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Thomas Seidl", + "homepage": "https://www.drupal.org/u/drunken-monkey" + }, + { + "name": "Nick Veenhof", + "homepage": "https://www.drupal.org/u/nick_vh" + }, + { + "name": "See other contributors", + "homepage": "https://www.drupal.org/node/790418/committers" + } + ], + "description": "Provides a generic framework for modules offering search capabilities.", + "homepage": "https://www.drupal.org/project/search_api", + "support": { + "source": "https://git.drupalcode.org/project/search_api", + "issues": "https://www.drupal.org/project/issues/search_api", + "irc": "irc://irc.freenode.org/drupal-search-api" + } + }, { "name": "drupal/simple_oauth", "version": "5.2.5", diff --git a/apps/cms/config/sync/coffee.configuration.yml b/apps/cms/config/sync/coffee.configuration.yml new file mode 100644 index 000000000..9948edc1c --- /dev/null +++ b/apps/cms/config/sync/coffee.configuration.yml @@ -0,0 +1,5 @@ +_core: + default_config_hash: cOqVnz_7pbb_0R31nQwih4Gh8XkmIbyFagFp6uUPaOc +coffee_menus: + admin: admin +max_results: 7 diff --git a/apps/cms/config/sync/core.entity_view_display.config_pages.website_settings.global_search.yml b/apps/cms/config/sync/core.entity_view_display.config_pages.website_settings.global_search.yml new file mode 100644 index 000000000..215f16377 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.config_pages.website_settings.global_search.yml @@ -0,0 +1,32 @@ +uuid: f70db696-2977-4e3b-b3d6-0c2c38d446b6 +langcode: en +status: true +dependencies: + config: + - config_pages.type.website_settings + - core.entity_view_mode.config_pages.global_search + - field.field.config_pages.website_settings.field_404_page + - field.field.config_pages.website_settings.field_home_page +id: config_pages.website_settings.global_search +targetEntityType: config_pages +bundle: website_settings +mode: global_search +content: + field_404_page: + type: entity_reference_label + label: hidden + settings: + link: false + third_party_settings: { } + weight: 1 + region: content + field_home_page: + type: entity_reference_label + label: hidden + settings: + link: false + third_party_settings: { } + weight: 2 + region: content +hidden: + search_api_excerpt: true diff --git a/apps/cms/config/sync/core.entity_view_display.media.document.global_search.yml b/apps/cms/config/sync/core.entity_view_display.media.document.global_search.yml new file mode 100644 index 000000000..1ba053193 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.media.document.global_search.yml @@ -0,0 +1,37 @@ +uuid: e4abb3ab-7ad2-4526-a7f1-5d2490f96c78 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.media.global_search + - field.field.media.document.field_media_file + - media.type.document + module: + - file +id: media.document.global_search +targetEntityType: media +bundle: document +mode: global_search +content: + field_media_file: + type: file_default + label: hidden + settings: + use_description_as_link_text: true + third_party_settings: { } + weight: 1 + region: content + name: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + created: true + langcode: true + search_api_excerpt: true + thumbnail: true + uid: true diff --git a/apps/cms/config/sync/core.entity_view_display.media.image.global_search.yml b/apps/cms/config/sync/core.entity_view_display.media.image.global_search.yml new file mode 100644 index 000000000..ac52a7d3b --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.media.image.global_search.yml @@ -0,0 +1,37 @@ +uuid: ee74d301-5723-4317-959d-4ebf11c34c5a +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.media.global_search + - field.field.media.image.field_media_image + - media.type.image + module: + - image +id: media.image.global_search +targetEntityType: media +bundle: image +mode: global_search +content: + field_media_image: + type: image_url + label: hidden + settings: + image_style: '' + third_party_settings: { } + weight: 1 + region: content + name: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + created: true + langcode: true + search_api_excerpt: true + thumbnail: true + uid: true diff --git a/apps/cms/config/sync/core.entity_view_display.media.remote_video.global_search.yml b/apps/cms/config/sync/core.entity_view_display.media.remote_video.global_search.yml new file mode 100644 index 000000000..9b6b6c2fb --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.media.remote_video.global_search.yml @@ -0,0 +1,35 @@ +uuid: 0719287e-1b69-47e5-a510-06fcb867982a +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.media.global_search + - field.field.media.remote_video.field_media_oembed_video + - media.type.remote_video +id: media.remote_video.global_search +targetEntityType: media +bundle: remote_video +mode: global_search +content: + field_media_oembed_video: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 1 + region: content + name: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + created: true + langcode: true + search_api_excerpt: true + thumbnail: true + uid: true diff --git a/apps/cms/config/sync/core.entity_view_display.media.video.global_search.yml b/apps/cms/config/sync/core.entity_view_display.media.video.global_search.yml new file mode 100644 index 000000000..d2bd5ec24 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.media.video.global_search.yml @@ -0,0 +1,36 @@ +uuid: 9dfe81b7-833b-42c9-b468-ab9725180311 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.media.global_search + - field.field.media.video.field_media_video_file + - media.type.video + module: + - file +id: media.video.global_search +targetEntityType: media +bundle: video +mode: global_search +content: + field_media_video_file: + type: file_url_plain + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content + name: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 0 + region: content +hidden: + created: true + langcode: true + search_api_excerpt: true + thumbnail: true + uid: true diff --git a/apps/cms/config/sync/core.entity_view_display.node.page.default.yml b/apps/cms/config/sync/core.entity_view_display.node.page.default.yml index 934b9c780..b85a8523f 100644 --- a/apps/cms/config/sync/core.entity_view_display.node.page.default.yml +++ b/apps/cms/config/sync/core.entity_view_display.node.page.default.yml @@ -41,3 +41,4 @@ hidden: body: true langcode: true links: true + search_api_excerpt: true diff --git a/apps/cms/config/sync/core.entity_view_display.node.page.global_search.yml b/apps/cms/config/sync/core.entity_view_display.node.page.global_search.yml new file mode 100644 index 000000000..d56a0127a --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.node.page.global_search.yml @@ -0,0 +1,40 @@ +uuid: f030f353-55d5-40d0-aaac-9bb42f8236c0 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.global_search + - field.field.node.page.body + - field.field.node.page.field_metatags + - node.type.page + module: + - gutenberg + - metatag + - user +id: node.page.global_search +targetEntityType: node +bundle: page +mode: global_search +content: + body: + type: gutenberg_text + label: hidden + settings: + format: gutenberg + content_only: true + third_party_settings: { } + weight: 1 + region: content + field_metatags: + type: metatag_empty_formatter + label: hidden + settings: { } + third_party_settings: { } + weight: 0 + region: content +hidden: + content_moderation_control: true + external_preview_link: true + langcode: true + links: true + search_api_excerpt: true diff --git a/apps/cms/config/sync/core.entity_view_display.user.user.global_search.yml b/apps/cms/config/sync/core.entity_view_display.user.user.global_search.yml new file mode 100644 index 000000000..d1d319335 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_display.user.user.global_search.yml @@ -0,0 +1,18 @@ +uuid: 4f0dd15a-c0ad-4f09-a785-7bba608a3918 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.user.global_search + module: + - user +id: user.user.global_search +targetEntityType: user +bundle: user +mode: global_search +content: { } +hidden: + langcode: true + masquerade: true + member_for: true + search_api_excerpt: true diff --git a/apps/cms/config/sync/core.entity_view_mode.config_pages.global_search.yml b/apps/cms/config/sync/core.entity_view_mode.config_pages.global_search.yml new file mode 100644 index 000000000..550a7c835 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_mode.config_pages.global_search.yml @@ -0,0 +1,11 @@ +uuid: cad6a443-33e0-4c9a-a4c9-621eb5ec300c +langcode: en +status: true +dependencies: + module: + - config_pages +id: config_pages.global_search +label: 'Global search' +description: 'View mode used for indexing the content in the administrative global search.' +targetEntityType: config_pages +cache: true diff --git a/apps/cms/config/sync/core.entity_view_mode.media.global_search.yml b/apps/cms/config/sync/core.entity_view_mode.media.global_search.yml new file mode 100644 index 000000000..9b784f308 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_mode.media.global_search.yml @@ -0,0 +1,11 @@ +uuid: 8a58c23a-3a33-428f-a2ba-312a2e968833 +langcode: en +status: true +dependencies: + module: + - media +id: media.global_search +label: 'Global search' +description: 'View mode used for indexing the content in the administrative global search.' +targetEntityType: media +cache: true diff --git a/apps/cms/config/sync/core.entity_view_mode.node.global_search.yml b/apps/cms/config/sync/core.entity_view_mode.node.global_search.yml new file mode 100644 index 000000000..a71429643 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_mode.node.global_search.yml @@ -0,0 +1,11 @@ +uuid: 49d32b79-bacb-4a0f-a8d5-ed92e6e52682 +langcode: en +status: true +dependencies: + module: + - node +id: node.global_search +label: 'Global search' +description: 'View mode used for indexing the content in the administrative global search.' +targetEntityType: node +cache: true diff --git a/apps/cms/config/sync/core.entity_view_mode.user.global_search.yml b/apps/cms/config/sync/core.entity_view_mode.user.global_search.yml new file mode 100644 index 000000000..a3ac19a33 --- /dev/null +++ b/apps/cms/config/sync/core.entity_view_mode.user.global_search.yml @@ -0,0 +1,11 @@ +uuid: 7a3527a5-2ee0-4805-994f-75cbfdb55f09 +langcode: en +status: true +dependencies: + module: + - user +id: user.global_search +label: 'Global search' +description: 'View mode used for indexing the content in the administrative global search.' +targetEntityType: user +cache: true diff --git a/apps/cms/config/sync/core.extension.yml b/apps/cms/config/sync/core.extension.yml index 43ff24530..89b47d675 100644 --- a/apps/cms/config/sync/core.extension.yml +++ b/apps/cms/config/sync/core.extension.yml @@ -7,6 +7,7 @@ module: block: 0 block_content: 0 breakpoint: 0 + coffee: 0 config: 0 config_ignore: 0 config_notify: 0 @@ -64,6 +65,9 @@ module: replicate_ui: 0 reroute_email: 0 role_delegation: 0 + search_api: 0 + search_api_db: 0 + search_api_global: 0 serialization: 0 shortcut: 0 silverback_ai: 0 diff --git a/apps/cms/config/sync/search_api.index.global_search.yml b/apps/cms/config/sync/search_api.index.global_search.yml new file mode 100644 index 000000000..68aeccd97 --- /dev/null +++ b/apps/cms/config/sync/search_api.index.global_search.yml @@ -0,0 +1,321 @@ +uuid: 1766ffc9-eb9e-40b8-adb6-3ebbf8013c78 +langcode: en +status: true +dependencies: + config: + - field.storage.media.field_media_image + - field.storage.media.field_media_video_file + - field.storage.media.field_media_oembed_video + - search_api.server.database + - core.entity_view_mode.config_pages.global_search + - core.entity_view_mode.media.global_search + - core.entity_view_mode.node.global_search + - core.entity_view_mode.user.global_search + module: + - menu_link_content + - user + - search_api + - config_pages + - media + - node + - taxonomy + - webform +id: global_search +name: 'Global search' +description: '' +read_only: false +field_settings: + alt: + label: 'Image » Alternative text' + datasource_id: 'entity:media' + property_path: 'field_media_image:alt' + type: text + dependencies: + config: + - field.storage.media.field_media_image + bundle_menu_link: + label: 'Custom menu link bundle' + datasource_id: 'entity:menu_link_content' + property_path: bundle + type: text + dependencies: + module: + - menu_link_content + description: + label: 'Video file » Description' + datasource_id: 'entity:media' + property_path: 'field_media_video_file:description' + type: text + dependencies: + config: + - field.storage.media.field_media_video_file + description_menu_link: + label: Description + datasource_id: 'entity:menu_link_content' + property_path: description + type: text + dependencies: + module: + - menu_link_content + field_media_oembed_video: + label: 'Remote video URL' + datasource_id: 'entity:media' + property_path: field_media_oembed_video + type: text + dependencies: + config: + - field.storage.media.field_media_oembed_video + mail: + label: Email + datasource_id: 'entity:user' + property_path: mail + type: text + dependencies: + module: + - user + menu_name: + label: 'Menu name' + datasource_id: 'entity:menu_link_content' + property_path: menu_name + type: text + dependencies: + module: + - menu_link_content + rendered_item: + label: 'Rendered HTML output' + property_path: rendered_item + type: text + configuration: + roles: + - editor + view_mode: + 'entity:config_pages': + website_settings: global_search + 'entity:media': + document: global_search + image: global_search + remote_video: global_search + video: global_search + 'entity:menu_link_content': + menu_link_content: '' + 'entity:node': + page: global_search + 'entity:taxonomy_term': + taxonomy_term: '' + 'entity:user': + user: global_search + 'entity:webform_submission': + contact: '' + inquiry: '' + styling: '' + title: + label: 'Image » Title' + datasource_id: 'entity:media' + property_path: 'field_media_image:title' + type: text + dependencies: + config: + - field.storage.media.field_media_image + title_menu_link: + label: 'Menu link title' + datasource_id: 'entity:menu_link_content' + property_path: title + type: text + dependencies: + module: + - menu_link_content +datasource_settings: + 'entity:config_pages': + bundles: + default: true + selected: { } + 'entity:media': + bundles: + default: true + selected: { } + languages: + default: true + selected: { } + 'entity:menu_link_content': + bundles: + default: true + selected: { } + languages: + default: true + selected: { } + 'entity:node': + bundles: + default: true + selected: { } + languages: + default: true + selected: { } + 'entity:taxonomy_term': + bundles: + default: true + selected: { } + languages: + default: true + selected: { } + 'entity:user': + languages: + default: true + selected: { } + 'entity:webform_submission': + bundles: + default: true + selected: { } +processor_settings: + add_url: { } + aggregated_field: { } + custom_value: { } + entity_type: { } + highlight: + weights: + postprocess_query: 0 + prefix: '' + suffix: '' + excerpt: true + excerpt_always: true + excerpt_length: 256 + exclude_fields: { } + highlight: always + highlight_partial: true + html_filter: + weights: + preprocess_index: -15 + preprocess_query: -15 + all_fields: true + fields: + - alt + - bundle_menu_link + - description + - description_menu_link + - field_media_oembed_video + - mail + - menu_name + - rendered_item + - title + - title_menu_link + title: true + alt: true + tags: + b: 2 + h1: 5 + h2: 3 + h3: 2 + strong: 2 + ignorecase: + weights: + preprocess_index: -20 + preprocess_query: -20 + all_fields: true + fields: + - alt + - bundle_menu_link + - description + - description_menu_link + - field_media_oembed_video + - mail + - menu_name + - rendered_item + - title + - title_menu_link + language_with_fallback: { } + rendered_item: { } + stopwords: + weights: + preprocess_index: -5 + preprocess_query: -2 + all_fields: true + fields: + - alt + - bundle_menu_link + - description + - description_menu_link + - field_media_oembed_video + - mail + - menu_name + - rendered_item + - title + - title_menu_link + stopwords: + - a + - an + - and + - are + - as + - at + - be + - but + - by + - for + - if + - in + - into + - is + - it + - 'no' + - not + - of + - 'on' + - or + - s + - such + - t + - that + - the + - their + - then + - there + - these + - they + - this + - to + - was + - will + - with + tokenizer: + weights: + preprocess_index: -6 + preprocess_query: -6 + all_fields: true + fields: + - alt + - bundle_menu_link + - description + - description_menu_link + - field_media_oembed_video + - mail + - menu_name + - rendered_item + - title + - title_menu_link + spaces: '' + ignored: ._- + overlap_cjk: 1 + minimum_word_size: '3' + transliteration: + weights: + preprocess_index: -20 + preprocess_query: -20 + all_fields: true + fields: + - alt + - bundle_menu_link + - description + - description_menu_link + - field_media_oembed_video + - mail + - menu_name + - rendered_item + - title + - title_menu_link +tracker_settings: + default: + indexing_order: fifo +options: + cron_limit: 50 + index_directly: true + track_changes_in_references: true +server: database diff --git a/apps/cms/config/sync/search_api.server.database.yml b/apps/cms/config/sync/search_api.server.database.yml new file mode 100644 index 000000000..b45105dde --- /dev/null +++ b/apps/cms/config/sync/search_api.server.database.yml @@ -0,0 +1,15 @@ +uuid: a9d5de42-f413-4908-8363-1cb432ac234e +langcode: en +status: true +dependencies: + module: + - search_api_db +id: database +name: Database +description: '' +backend: search_api_db +backend_config: + database: 'default:default' + min_chars: 1 + matching: partial + phrase: bigram diff --git a/apps/cms/config/sync/search_api.settings.yml b/apps/cms/config/sync/search_api.settings.yml new file mode 100644 index 000000000..510a3e528 --- /dev/null +++ b/apps/cms/config/sync/search_api.settings.yml @@ -0,0 +1,28 @@ +_core: + default_config_hash: b2zIRm9Jv3SB60NYdZkZHxH8-KdEa-Xa48-4NsIi4lg +default_cron_limit: 50 +cron_worker_runtime: 15 +default_tracker: default +tracking_page_size: 100 +boost_factors: + - 0.0 + - 0.1 + - 0.2 + - 0.3 + - 0.5 + - 0.6 + - 0.7 + - 0.8 + - 0.9 + - 1.0 + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 2.0 + - 3.0 + - 5.0 + - 8.0 + - 13.0 + - 21.0 diff --git a/apps/cms/config/sync/search_api_db.settings.yml b/apps/cms/config/sync/search_api_db.settings.yml new file mode 100644 index 000000000..32ffc9406 --- /dev/null +++ b/apps/cms/config/sync/search_api_db.settings.yml @@ -0,0 +1,3 @@ +_core: + default_config_hash: fEmluJPpUL5dVqkWi0Fw89OlZYLhjQqyZIl6HWCDE1s +autocomplete_max_occurrences: 0.9 diff --git a/apps/cms/config/sync/views.view.global_search.yml b/apps/cms/config/sync/views.view.global_search.yml new file mode 100644 index 000000000..117d339e4 --- /dev/null +++ b/apps/cms/config/sync/views.view.global_search.yml @@ -0,0 +1,266 @@ +uuid: 71cd78a3-c1d1-47da-a2cb-a462d1112d98 +langcode: en +status: true +dependencies: + config: + - search_api.index.global_search + module: + - search_api + - user +id: global_search +label: 'Global search' +module: views +description: '' +tag: '' +base_table: search_api_index_global_search +base_field: search_api_id +display: + default: + id: default + display_title: Default + display_plugin: default + position: 0 + display_options: + title: 'Global search' + fields: + search_api_id: + id: search_api_id + table: search_api_index_global_search + field: search_api_id + relationship: none + group_type: group + admin_label: '' + plugin_id: standard + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + search_api_excerpt: + id: search_api_excerpt + table: search_api_index_global_search + field: search_api_excerpt + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_item: true + use_highlighting: true + multi_type: separator + multi_separator: ', ' + pager: + type: full + options: + offset: 0 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: ›› + previous: ‹‹ + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 9 + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access administration pages' + cache: + type: search_api_none + options: { } + empty: { } + sorts: { } + arguments: { } + filters: + search_api_fulltext: + id: search_api_fulltext + table: search_api_index_global_search + field: search_api_fulltext + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_fulltext + operator: or + 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' + super_admin: '0' + administrator: '0' + gatsby_build: '0' + editor: '0' + expose_fields: false + placeholder: '' + 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: + type: fields + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + query_tags: { } + relationships: { } + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_interface' + - url + - url.query_args + - user + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:search_api.index.global_search' + - 'search_api_list:global_search' + search: + id: search + display_title: Page + display_plugin: page + position: 1 + display_options: + display_extenders: { } + path: admin/search + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_interface' + - url + - url.query_args + - user + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:search_api.index.global_search' + - 'search_api_list:global_search' diff --git a/apps/cms/package.json b/apps/cms/package.json index d8d6137a0..73f8179a7 100644 --- a/apps/cms/package.json +++ b/apps/cms/package.json @@ -35,6 +35,7 @@ "@custom/schema": "workspace:*", "@custom/test_content": "workspace:*", "@custom/ui": "workspace:*", - "@custom/preview": "workspace:*" + "@custom/preview": "workspace:*", + "@custom/search_api_global": "workspace:*" } } diff --git a/apps/cms/patches/contrib/coffee/on_the_fly_ajax_search_poc.patch b/apps/cms/patches/contrib/coffee/on_the_fly_ajax_search_poc.patch new file mode 100644 index 000000000..7645fbce5 --- /dev/null +++ b/apps/cms/patches/contrib/coffee/on_the_fly_ajax_search_poc.patch @@ -0,0 +1,39 @@ +diff --git a/js/coffee.js b/js/coffee.js +index 23c4e09..f4ee07a 100644 +--- a/js/coffee.js ++++ b/js/coffee.js +@@ -13,10 +13,31 @@ + var initSource = proto._initSource; + + function filter(array, term) { +- var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), 'i'); +- return $.grep(array, function (value) { +- return matcher.test(value.command) || matcher.test(value.label) || matcher.test(value.value); ++ var matcher = new RegExp($.ui.autocomplete.escapeRegex(term.startsWith('#') ? term.substring(1) : term), 'i'); ++ // By default, we do an ajax request to get the available options using a ++ // search feature implemented on the server. However, if the command starts ++ // with '#', then juts use the default behavior to search through the array ++ // parameter, which contains all the static entries. ++ if (term.startsWith('#')) { ++ return $.grep(array, function (value) { ++ return matcher.test(value.command) || matcher.test(value.label) || matcher.test(value.value); ++ }) ++ } ++ ++ var results; ++ $.ajax({ ++ url: Drupal.url('global-search?search=' + encodeURIComponent(term)), ++ dataType: 'json', ++ // We have to wait for the request to complete before returning the ++ // results. ++ async: false, ++ success: function (data) { ++ results = $.grep(data, function (value) { ++ return matcher.test(value.command) || matcher.test(value.label) || matcher.test(value.value); ++ }); ++ } + }); ++ return results; + } + + $.extend(proto, { diff --git a/packages/drupal/gutenberg_blocks/gutenberg_blocks.gutenberg.yml b/packages/drupal/gutenberg_blocks/gutenberg_blocks.gutenberg.yml index 42c51a1e5..caff3c619 100644 --- a/packages/drupal/gutenberg_blocks/gutenberg_blocks.gutenberg.yml +++ b/packages/drupal/gutenberg_blocks/gutenberg_blocks.gutenberg.yml @@ -4,3 +4,5 @@ theme-support: dropCap: false libraries-edit: - gutenberg_blocks/edit +dynamic-blocks: + custom/hero: {} diff --git a/packages/drupal/gutenberg_blocks/templates/gutenberg-block--custom--hero.html.twig b/packages/drupal/gutenberg_blocks/templates/gutenberg-block--custom--hero.html.twig new file mode 100644 index 000000000..aed202cae --- /dev/null +++ b/packages/drupal/gutenberg_blocks/templates/gutenberg-block--custom--hero.html.twig @@ -0,0 +1,12 @@ +{% if block_attributes.headline %} +
{{ block_attributes.lead }}
+{% endif %} +{% if block_attributes.ctaUrl %} +{{ block_attributes.ctaUrl }}
+{% endif %} +{% if block_attributes.ctaText %} +{{ block_attributes.ctaText }}
+{% endif %} diff --git a/packages/drupal/search_api_global/package.json b/packages/drupal/search_api_global/package.json new file mode 100644 index 000000000..dadee9231 --- /dev/null +++ b/packages/drupal/search_api_global/package.json @@ -0,0 +1,5 @@ +{ + "name": "@custom/search_api_global", + "version": "1.0.0", + "private": true +} diff --git a/packages/drupal/search_api_global/search_api_global.info.yml b/packages/drupal/search_api_global/search_api_global.info.yml new file mode 100644 index 000000000..736deccbb --- /dev/null +++ b/packages/drupal/search_api_global/search_api_global.info.yml @@ -0,0 +1,6 @@ +name: Search API Global +package: Custom +type: module +core_version_requirement: ^10.0 || ^11.0 +dependencies: + - search_api:search_api diff --git a/packages/drupal/search_api_global/search_api_global.module b/packages/drupal/search_api_global/search_api_global.module new file mode 100644 index 000000000..b3d9bbc7f --- /dev/null +++ b/packages/drupal/search_api_global/search_api_global.module @@ -0,0 +1 @@ +query->get('search'); + // More advanced example to include view results. + if ($view = Views::getView('global_search')) { + $view->setDisplay('search'); + if (!empty($search)) { + $view->setExposedInput(['search_api_fulltext' => $search]); + } + $view->preExecute(); + $view->execute(); + + foreach ($view->result as $row) { + $entity = $row->_entity; + $url = ''; + try { + $url = $entity->toUrl()->toString(); + } catch (UndefinedLinkTemplateException|EntityMalformedException $e) { + // Just do nothing here, in case we could not build a URL we will just + // show an empty value there. + } + $commands[] = [ + 'value' => $url, + 'label' => $entity->label() . ' (' . $entity->getEntityType()->getLabel() . ')', + 'command' => $entity->label(), + ]; + } + } + return new JsonResponse($commands); + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca64c046a..4ca0656f4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ importers: '@custom/schema': specifier: workspace:* version: link:../../packages/schema + '@custom/search_api_global': + specifier: workspace:* + version: link:../../packages/drupal/search_api_global '@custom/test_content': specifier: workspace:* version: link:../../packages/drupal/test_content @@ -525,6 +528,8 @@ importers: specifier: ^5.0.10 version: 5.4.1(@types/node@18.15.3) + packages/drupal/search_api_global: {} + packages/drupal/test_content: {} packages/schema: @@ -4618,6 +4623,19 @@ packages: lodash: 4.17.21 tslib: 2.4.1 + /@graphql-codegen/plugin-helpers@3.1.2(graphql@16.8.1): + resolution: {integrity: sha512-emOQiHyIliVOIjKVKdsI5MXj312zmRDwmHpyUTZMjfpvxq/UVAHUJIVdVf+lnjjrI+LXBTgMlTWTgHQfmICxjg==} + peerDependencies: + graphql: 16.8.1 + dependencies: + '@graphql-tools/utils': 8.13.1(graphql@16.8.1) + change-case-all: 1.0.14 + common-tags: 1.8.2 + graphql: 16.8.1 + import-from: 4.0.0 + lodash: 4.17.21 + tslib: 2.4.1 + /@graphql-codegen/plugin-helpers@3.1.2(graphql@16.8.1): resolution: {integrity: sha512-emOQiHyIliVOIjKVKdsI5MXj312zmRDwmHpyUTZMjfpvxq/UVAHUJIVdVf+lnjjrI+LXBTgMlTWTgHQfmICxjg==} peerDependencies: