顧客のWebサイトにSearch APIを使用しており、開始日と終了日の公開フィルター付きのViewがあります。
d/m/Y形式を使用するため、ブラジルでは無効なm/d/Y形式を使用する場合、ビューは正しくフィルタリングするだけです(最初の日)。
解決策を検索しようとしましたが、主にカスタムコードまたはBetter Exposed Filtersを使用しますが、これはDrupal 8では安定していません。 Date Popupは、Search APIフィールドでも機能しません。彼らはそれを修正しましたが、2017年以降、新しいバージョンをリリースしていません(この修正は、私が推測するdevブランチでのみ利用可能です)。
「日付と時刻の形式」で新しい日付形式を作成して日付フィールドをこの形式に設定しようとしましたが、それも機能しません。
安定しないモジュールを使用することはnotの選択であり、私はDrupal UI(カスタムコードではなく)のみを使用してこれを解決したいと思います
2020年4月18日から2020年4月22日までフィルタリングしようとしましたが、2020年4月20日に書かれたコンテンツがありますが、何も返されません
PS:スクリーンショットはポルトガル語(ブラジル)です。申し訳ありません。
これが役立つ場合のビューのエクスポートです:
uuid: e60ffc0d-fa69-4581-8ee5-585f128ffcec
langcode: pt-br
status: true
dependencies:
config:
- field.storage.node.body
- field.storage.node.field_tags
- search_api.index.conteudo
- taxonomy.vocabulary.tags
module:
- search_api
- text
- views_infinite_scroll
id: busca
label: Busca
module: views
description: ''
tag: ''
base_table: search_api_index_conteudo
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: input_required
options:
submit_button: Buscar
reset_button: true
reset_button_label: Limpar
exposed_sorts_label: 'Ordenar por'
expose_sort_order: true
sort_asc_label: 'Ordem crescente'
sort_desc_label: 'Ordem decrescente'
text_input_required: 'Aplique um filtro para ver os resultados'
text_input_required_format: raw_html
pager:
type: infinite_scroll
options:
items_per_page: 15
offset: 0
id: 0
total_pages: null
tags:
previous: Anterior
next: Próximo
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
views_infinite_scroll:
button_text: 'Total de Resultados: @total | Carregar mais @next_page_count'
automatically_load_content: false
style:
type: default
row:
type: fields
fields:
created:
id: created
table: search_api_datasource_conteudo_entity_node
field: created
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: ''
element_class: created
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
click_sort_column: value
type: timestamp
settings:
date_format: custom
custom_date_format: d/m/Y
timezone: ''
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_date
fallback_options:
date_format: fallback
custom_date_format: ''
timezone: ''
link_to_item: false
use_highlighting: false
multi_type: separator
multi_separator: ', '
entity_type: node
plugin_id: search_api_field
title:
id: title
table: search_api_index_conteudo
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: ''
element_class: title
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
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_conteudo
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: 250
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: ''
element_class: body
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
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
field_tags:
id: field_tags
table: search_api_datasource_conteudo_entity_node
field: field_tags
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: true
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: false
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: target_id
type: entity_reference_label
settings:
link: true
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:
abrangencia_do_evento:
display_method: label
agendas:
display_method: label
albuns:
display_method: label
view_mode: default
autoria:
display_method: label
categoria_do_evento:
display_method: label
categorias_de_noticias:
display_method: label
categorias_do_banco_de_imagens:
display_method: label
view_mode: default
categorias_do_banco_de_videos:
display_method: label
grupo:
display_method: label
grupos:
display_method: label
grupos_de_links:
display_method: label
local_de_publicacao_do_evento:
display_method: label
representante_do_evento:
display_method: label
subdivisao_de_grupos:
display_method: label
tags:
display_method: label
tipo_do_evento:
display_method: label
entity_type: node
plugin_id: search_api_field
created_1:
id: created_1
table: search_api_datasource_conteudo_entity_node
field: created
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: true
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
click_sort_column: value
type: timestamp
settings:
date_format: d_m_y
custom_date_format: d/m/Y
timezone: America/Sao_Paulo
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_date
fallback_options:
date_format: fallback
custom_date_format: ''
timezone: ''
link_to_item: false
use_highlighting: false
multi_type: separator
multi_separator: ', '
entity_type: node
plugin_id: search_api_field
filters:
search_api_fulltext:
id: search_api_fulltext
table: search_api_index_conteudo
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: 'Termo da Pesquisa'
description: ''
use_operator: false
operator: search_api_fulltext_op
identifier: search_api_fulltext
required: true
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
publicador_basico: '0'
publicador_presi: '0'
jornalista: '0'
publicidade: '0'
placeholder: 'Digite o termo da pesquisa'
operator_limit_selection: false
operator_list: { }
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
created:
id: created
table: search_api_index_conteudo
field: created
relationship: none
group_type: group
admin_label: ''
operator: '>='
value:
min: ''
max: ''
value: ''
type: date
group: 1
exposed: true
expose:
operator_id: created_op
label: 'Data inicial'
description: ''
use_operator: false
operator: created_op
identifier: initial_date
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
publicador_basico: '0'
publicador_presi: '0'
jornalista: '0'
publicidade: '0'
placeholder: 'Data inicial'
min_placeholder: ''
max_placeholder: ''
operator_limit_selection: false
operator_list: { }
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_date
created_1:
id: created_1
table: search_api_index_conteudo
field: created
relationship: none
group_type: group
admin_label: ''
operator: '<='
value:
min: ''
max: ''
value: ''
type: date
group: 1
exposed: true
expose:
operator_id: created_1_op
label: 'Data final'
description: ''
use_operator: false
operator: created_1_op
identifier: final_date
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
publicador_basico: '0'
publicador_presi: '0'
jornalista: '0'
publicidade: '0'
placeholder: 'Data final'
min_placeholder: ''
max_placeholder: ''
operator_limit_selection: false
operator_list: { }
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_date
status:
id: status
table: search_api_index_conteudo
field: status
relationship: none
group_type: group
admin_label: ''
operator: '='
value: '1'
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
operator_limit_selection: false
operator_list: { }
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
plugin_id: search_api_boolean
field_tags:
id: field_tags
table: search_api_index_conteudo
field: field_tags
relationship: none
group_type: group
admin_label: ''
operator: or
value: { }
group: 1
exposed: true
expose:
operator_id: field_tags_op
label: 'Tags de notícias'
description: ''
use_operator: false
operator: field_tags_op
identifier: field_tags
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
administrator: '0'
publicador_basico: '0'
publicador_presi: '0'
jornalista: '0'
publicidade: '0'
reduce: false
operator_limit_selection: false
operator_list: { }
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
type: select
limit: true
vid: tags
hierarchy: false
error_message: true
plugin_id: search_api_term
sorts:
created:
id: created
table: search_api_index_conteudo
field: created
relationship: none
group_type: group
admin_label: ''
order: DESC
exposed: false
expose:
label: 'Ordenar por data'
plugin_id: search_api
title: Busca
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: 'Sua busca não retornou nenhum resultado.'
plugin_id: text_custom
relationships: { }
arguments: { }
display_extenders: { }
css_class: search-result
use_ajax: true
filter_groups:
operator: AND
groups:
1: AND
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- user
tags:
- 'config:field.storage.node.body'
- 'config:field.storage.node.field_tags'
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: busca
exposed_block: false
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url
- url.query_args
- user
tags:
- 'config:field.storage.node.body'
- 'config:field.storage.node.field_tags'
この問題の1つの解決策は、日付ピッカーウィジェットです。これにより、ユーザーが特定の形式で日付を入力する必要がなくなります。
Date Popup モジュールを確認してください。