Drupal-搜索视图未触发Solr请求

时间:2018-11-12 08:10:06

标签: solr drupal-8

我有一个来自.yml文件的视图。它应该显示我手动创建的索引。但是,当我手动导入yaml文件时,不会触发搜索(即,当我启用Solr Search Devel时,它不会产生任何与搜索有关的信息,并且服务器不会收到任何请求)。

奇怪的是,如果我(通过GUI)手动创建完全相同的视图,则会正确触发搜索,并且Solr Search Devel将显示有关搜索的信息。

为什么我的视图不调用Search API?可以将其链接到yaml文件本身之外的其他链接吗?

这是我的yml

langcode: en
status: true
dependencies:
  enforced:
    module:
      - gref
  config:
    - field.storage.node.field_author_name
    - field.storage.node.field_isbn
    - field.storage.node.field_number_of_pages
    - field.storage.node.field_summary
    - search_api.index.books_index
  module:
    - search_api
    - text
id: gref_books_search_view
label: 'Gref Books Search View'
module: views
description: ''
tag: ''
base_table: search_api_index_books_index
base_field: search_api_id
core: 8.x
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
      exposed_form:
        type: basic
        options:
          submit_button: Rechercher
          reset_button: true
          reset_button_label: Reset
          exposed_sorts_label: 'trier par'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      pager:
        type: mini
        options:
          items_per_page: 10
          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: result-element
          default_row_class: true
          type: ul
          wrapper_class: item-list
          class: ''
      row:
        type: fields
      fields:
        title:
          id: title
          table: search_api_index_books_index
          field: title
          relationship: none
          group_type: group
          admin_label: ''
          label: Title
          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: result_title
          element_label_type: ''
          element_label_class: title_label
          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
          click_sort_column: value
          type: string
          settings:
            link_to_entity: false
          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
        field_author_name:
          id: field_author_name
          table: search_api_index_books_index
          field: field_author_name
          relationship: none
          group_type: group
          admin_label: ''
          label: 'Author Name'
          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: 50
            word_boundary: false
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: true
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: result_author
          element_label_type: ''
          element_label_class: author_label
          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
          click_sort_column: value
          type: string
          settings:
            link_to_entity: false
          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: ', '
          entity_type: null
          entity_field: null
          plugin_id: search_api_field
        field_summary:
          id: field_summary
          table: search_api_index_books_index
          field: field_summary
          relationship: none
          group_type: group
          admin_label: ''
          label: Summary
          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: 100
            word_boundary: false
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: true
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: result_summary
          element_label_type: ''
          element_label_class: summary_label
          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
          click_sort_column: value
          type: string
          settings:
            link_to_entity: false
          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
        field_number_of_pages:
          id: field_number_of_pages
          table: search_api_index_books_index
          field: field_number_of_pages
          relationship: none
          group_type: group
          admin_label: ''
          label: 'No. Pages'
          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: result_no_pages
          element_label_type: ''
          element_label_class: no_pages_label
          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
          click_sort_column: value
          type: number_integer
          settings:
            thousand_separator: ''
            prefix_suffix: 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_numeric
          fallback_options:
            set_precision: false
            precision: 0
            decimal: .
            separator: ','
            format_plural: false
            format_plural_string: !!binary MQNAY291bnQ=
            prefix: ''
            suffix: ''
            link_to_item: false
            use_highlighting: false
            multi_type: separator
            multi_separator: ', '
            format_plural_values:
              - '1'
              - '@count'
          plugin_id: search_api_field
        field_isbn:
          id: field_isbn
          table: search_api_index_books_index
          field: field_isbn
          relationship: none
          group_type: group
          admin_label: ''
          label: ISBN
          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: result_isbn
          element_label_type: ''
          element_label_class: isbn_label
          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
          click_sort_column: value
          type: text_default
          settings: {  }
          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
      filters:
        search_api_fulltext:
          id: search_api_fulltext
          table: search_api_index_books_index
          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: ''
            description: ''
            use_operator: false
            operator: search_api_fulltext_op
            identifier: search_api_fulltext
            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: {  }
      title: 'Recherche dans les livres'
      header: {  }
      footer: {  }
      empty:
        area:
          id: area
          table: views
          field: area
          relationship: none
          group_type: group
          admin_label: ''
          empty: true
          tokenize: false
          content:
            value: 'No results were found.'
            format: basic_html
          plugin_id: text
      relationships: {  }
      arguments: {  }
      display_extenders: {  }
      use_ajax: true
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - url.query_args
      tags:
        - 'config:field.storage.node.field_author_name'
        - 'config:field.storage.node.field_isbn'
        - 'config:field.storage.node.field_number_of_pages'
        - 'config:field.storage.node.field_summary'
  page_1:
    display_plugin: page
    id: page_1
    display_title: Page
    position: 1
    display_options:
      display_extenders: {  }
      path: gref/books
      cache:
        type: none
      defaults:
        cache: false
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - url
        - url.query_args
      tags:
        - 'config:field.storage.node.field_author_name'
        - 'config:field.storage.node.field_isbn'
        - 'config:field.storage.node.field_number_of_pages'
        - 'config:field.storage.node.field_summary'

1 个答案:

答案 0 :(得分:0)

对于遇到相同问题的任何人,我都设法解决了该问题。

在我的情况下,这是因为附加到视图的一个方面引用了Solr索引中不存在的字段。由于/var/log/apache2/error.log对此一无所知,因此我完全随机地偶然发现了它。

检查您使用的所有方面是否都引用了现有字段。