diff --git a/modules/custom/apigee_kickstart_search/README.md b/modules/custom/apigee_kickstart_search/README.md new file mode 100644 index 00000000..dfc7b76c --- /dev/null +++ b/modules/custom/apigee_kickstart_search/README.md @@ -0,0 +1,17 @@ +# Introduction +The `apigee_kickstart_search` module Adds a search page for searching content and APIs. + +## Installation + +1. Visit **Extend --> Install new module** from the admin toolbar. +2. Enable the `Apigee Kickstart Search` module. +3. Visit `/admin/reports/status` and click on **Run cron** to re-index content. + +## Customization + +- To add new entity types to the search index or to configure fields *boost*, see the configuration form at `/admin/config/search/search-api/index/default/edit`. +- To customize the search results, see the view at `admin/structure/views/view/apigee_kickstart_search`. + +### Note + +When enabled, the `apigee_kickstart_search` module redirects all search queries from the search form in the header to the `/search`. diff --git a/modules/custom/apigee_kickstart_search/apigee_kickstart_search.info.yml b/modules/custom/apigee_kickstart_search/apigee_kickstart_search.info.yml new file mode 100644 index 00000000..25e37285 --- /dev/null +++ b/modules/custom/apigee_kickstart_search/apigee_kickstart_search.info.yml @@ -0,0 +1,9 @@ +name: Apigee Kickstart Search +description: "Adds a search page for searching content and APIs." +type: module +core: 8.x +package: Apigee Kickstart (Experimental) +dependencies: + - apigee_api_catalog:apigee_api_catalog + - drupal:views + - search_api:search_api_db diff --git a/modules/custom/apigee_kickstart_search/apigee_kickstart_search.module b/modules/custom/apigee_kickstart_search/apigee_kickstart_search.module new file mode 100644 index 00000000..cc5fe28e --- /dev/null +++ b/modules/custom/apigee_kickstart_search/apigee_kickstart_search.module @@ -0,0 +1,40 @@ +' + suffix: '' + weights: + postprocess_query: 0 + html_filter: + all_fields: true + fields: + - body + - description + - field_answer + - field_content + - name + - title + title: true + alt: true + tags: + b: 2 + h1: 5 + h2: 3 + h3: 2 + strong: 2 + weights: + preprocess_index: -15 + preprocess_query: -15 + ignorecase: + all_fields: true + fields: + - body + - description + - field_answer + - field_content + - name + - title + weights: + preprocess_index: -20 + preprocess_query: -20 + language_with_fallback: { } + rendered_item: { } + stopwords: + all_fields: true + fields: + - body + - description + - field_answer + - field_content + - name + - title + 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 + weights: + preprocess_index: -5 + preprocess_query: -2 + tokenizer: + all_fields: true + fields: + - body + - description + - field_answer + - field_content + - name + - title + spaces: '' + overlap_cjk: 1 + minimum_word_size: '3' + weights: + preprocess_index: -6 + preprocess_query: -6 + transliteration: + all_fields: true + fields: + - body + - description + - field_answer + - field_content + - name + - title + weights: + preprocess_index: -20 + preprocess_query: -20 +tracker_settings: + default: + indexing_order: fifo +options: + index_directly: true + cron_limit: 50 +server: default diff --git a/modules/custom/apigee_kickstart_search/config/optional/search_api.server.default.yml b/modules/custom/apigee_kickstart_search/config/optional/search_api.server.default.yml new file mode 100644 index 00000000..ff7b8a33 --- /dev/null +++ b/modules/custom/apigee_kickstart_search/config/optional/search_api.server.default.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: + module: + - search_api_db +id: default +name: Default +description: 'The default server for Apigee Kickstart.' +backend: search_api_db +backend_config: + database: 'default:default' + min_chars: 1 + matching: words + autocomplete: + suggest_suffix: true + suggest_words: true diff --git a/modules/custom/apigee_kickstart_search/config/optional/views.view.apigee_kickstart_search.yml b/modules/custom/apigee_kickstart_search/config/optional/views.view.apigee_kickstart_search.yml new file mode 100644 index 00000000..819978cb --- /dev/null +++ b/modules/custom/apigee_kickstart_search/config/optional/views.view.apigee_kickstart_search.yml @@ -0,0 +1,671 @@ +langcode: en +status: true +dependencies: + config: + - search_api.index.default + module: + - better_exposed_filters + - search_api +id: apigee_kickstart_search +label: Apigee Kickstart Search +module: views +description: '' +tag: '' +base_table: search_api_index_default +base_field: search_api_id +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: none + options: { } + cache: + type: tag + options: { } + query: + type: views_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + exposed_form: + type: bef + options: + submit_button: Search + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + input_required: true + text_input_required: '
Enter keywords in the search form above to search.
' + bef: + general: + allow_secondary: false + secondary_label: 'Advanced options' + autosubmit: false + autosubmit_exclude_textfield: false + autosubmit_hide: false + search_api_fulltext: + bef_format: default + more_options: + is_secondary: false + placeholder_text: '' + rewrite: + filter_rewrite_values: '' + text_input_required_format: full_html + pager: + type: mini + options: + items_per_page: 20 + offset: 0 + id: 0 + total_pages: null + 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 + tags: + previous: ‹‹ + next: ›› + style: + type: html_list + options: + grouping: { } + row_class: 'search-results__item my-4' + default_row_class: false + type: ol + wrapper_class: 'search-results py-4' + class: search-results__list + row: + type: fields + fields: + type: + id: type + table: search_api_datasource_default_entity_node + field: type + relationship: none + group_type: group + admin_label: '' + 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: span + element_class: 'search-result__type badge badge-light mb-3' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: API + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api_entity + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + display_methods: + node_type: + display_method: label + entity_type: node + plugin_id: search_api_field + name: + id: name + table: search_api_index_default + field: name + relationship: none + group_type: group + admin_label: '' + 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: h5 + element_class: search-result__title + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + plugin_id: search_api_field + description: + id: description + table: search_api_index_default + field: description + relationship: none + group_type: group + admin_label: '' + 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: div + element_class: search-result__text + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_item: false + use_highlighting: true + multi_type: separator + multi_separator: ', ' + plugin_id: search_api + title: + id: title + table: search_api_index_default + field: title + relationship: none + group_type: group + admin_label: '' + 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: h5 + element_class: search-result__title + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: string + settings: + link_to_entity: true + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + plugin_id: search_api_field + body: + id: body + table: search_api_index_default + field: body + relationship: none + group_type: group + admin_label: '' + 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: 350 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: true + preserve_tags: '' + html: false + element_type: div + element_class: search-result__text + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_item: false + use_highlighting: true + multi_type: separator + multi_separator: ', ' + plugin_id: search_api + field_answer: + id: field_answer + table: search_api_index_default + field: field_answer + relationship: none + group_type: group + admin_label: '' + 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: 350 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: true + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '0' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_item: false + use_highlighting: true + multi_type: separator + multi_separator: ', ' + plugin_id: search_api + field_content: + id: field_content + table: search_api_index_default + field: field_content + relationship: none + group_type: group + admin_label: '' + 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: 350 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: true + trim: true + preserve_tags: ' '
+ html: false
+ element_type: div
+ element_class: search-result__text
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: false
+ element_wrapper_type: '0'
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_empty: false
+ empty_zero: false
+ hide_alter_empty: true
+ link_to_item: false
+ use_highlighting: true
+ multi_type: separator
+ multi_separator: ', '
+ plugin_id: search_api
+ nothing:
+ id: nothing
+ table: views
+ field: nothing
+ relationship: none
+ group_type: group
+ admin_label: ''
+ label: ''
+ exclude: false
+ alter:
+ alter_text: true
+ text: ' Your search yielded no results.
'
+ 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: false
+ plugin_id: custom
+ filters:
+ search_api_fulltext:
+ id: search_api_fulltext
+ table: search_api_index_default
+ field: search_api_fulltext
+ relationship: none
+ group_type: group
+ admin_label: ''
+ operator: and
+ value: ''
+ group: 1
+ exposed: true
+ expose:
+ operator_id: search_api_fulltext_op
+ label: 'Enter your keywords'
+ description: ''
+ use_operator: false
+ operator: search_api_fulltext_op
+ operator_limit_selection: false
+ operator_list: { }
+ identifier: keys
+ required: false
+ remember: false
+ multiple: false
+ remember_roles:
+ authenticated: authenticated
+ anonymous: '0'
+ administrator: '0'
+ placeholder: ''
+ 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: { }
+ plugin_id: search_api_fulltext
+ sorts:
+ search_api_relevance:
+ id: search_api_relevance
+ table: search_api_index_default
+ field: search_api_relevance
+ relationship: none
+ group_type: group
+ admin_label: ''
+ order: ASC
+ exposed: false
+ expose:
+ label: ''
+ plugin_id: search_api
+ title: Search
+ header: { }
+ footer: { }
+ empty:
+ area_text_custom:
+ id: area_text_custom
+ table: views
+ field: area_text_custom
+ relationship: none
+ group_type: group
+ admin_label: ''
+ empty: true
+ tokenize: false
+ content: '