我希望找到一个替代字段收集模块。问题是,我想搜索(我使用搜索API +视图)字段集合中的子字段。
作为一个例子,如果我有一个字段集合"Field",如Research Paper
,包含以下字段:—
- 研究题目
- PDF文档。
我可以在我添加Research Paper
作为内容类型的页面中添加尽可能多的Research Papers
。
例如,以下是我添加的典型研究论文:-
- 《植物学》,《寻找可持续的资源》。pdf
- "经济学","消费者支出与天气状况的相关性研究。pdf"
- "数学","在有理数内估计π级数。pdf"
现在,问题来了,如果我通过一个视图通过搜索API创建一个搜索页面,并搜索"可持续来源的某某某某",我怎么能得到"植物学"的"研究论文"条目的链接,"寻找可持续来源的某某某某.pdf"?
我正在使用视图并通过"全文搜索(暴露)"进行搜索。
下面是视图,以防万一:
$view = new view;
$view->name = 'advanced_search';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_advanced_search_index';
$view->human_name = 'Advanced Search';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Advanced Search';
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Search';
$handler->display->display_options['exposed_form']['options']['autosubmit'] = 0;
$handler->display->display_options['exposed_form']['options']['autosubmit_hide'] = 1;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Indexed Node: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'search_api_index_advanced_search_index';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['title']['link_to_entity'] = 1;
/* Field: Indexed Node: The main body text » Summary */
$handler->display->display_options['fields']['body_summary']['id'] = 'body_summary';
$handler->display->display_options['fields']['body_summary']['table'] = 'search_api_index_advanced_search_index';
$handler->display->display_options['fields']['body_summary']['field'] = 'body_summary';
$handler->display->display_options['fields']['body_summary']['label'] = '';
$handler->display->display_options['fields']['body_summary']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['external'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['max_length'] = '200';
$handler->display->display_options['fields']['body_summary']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['body_summary']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['body_summary']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['body_summary']['alter']['trim'] = 1;
$handler->display->display_options['fields']['body_summary']['alter']['html'] = 0;
$handler->display->display_options['fields']['body_summary']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['body_summary']['element_default_classes'] = 1;
$handler->display->display_options['fields']['body_summary']['empty'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vitae est id metus vestibulum mattis. Donec sed dictum sapien. Proin facilisis vehicula elit nec molestie. Nullam scelerisque, urna non venenatis mattis, dolor neque ultricies tellus, quis lacinia mi ligula id risus. Curabitur congue gravida quam. Maecenas et luctus dui. Aliquam erat volutpat ...';
$handler->display->display_options['fields']['body_summary']['hide_empty'] = 0;
$handler->display->display_options['fields']['body_summary']['empty_zero'] = 1;
$handler->display->display_options['fields']['body_summary']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['body_summary']['link_to_entity'] = 0;
/* Field: Document Category » Uploaded File » The file.: Title Text (indexed) */
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['id'] = 'field_document_cat_field_field_document_file_field_file_image_title_text';
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['table'] = 'search_api_index_advanced_search_index';
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['field'] = 'field_document_cat_field_field_document_file_field_file_image_title_text';
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['element_label_colon'] = 1;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_document_cat_field_field_document_file_field_file_image_title_text']['field_api_classes'] = 0;
/* Filter criterion: Search: Fulltext search */
$handler->display->display_options['filters']['search_api_views_fulltext']['id'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['table'] = 'search_api_index_advanced_search_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['group'] = 1;
$handler->display->display_options['filters']['search_api_views_fulltext']['exposed'] = TRUE;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator_id'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['label'] = 'Search me';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['use_operator'] = 1;
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['operator'] = 'search_api_views_fulltext_op';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['identifier'] = 'search_api_views_fulltext';
$handler->display->display_options['filters']['search_api_views_fulltext']['expose']['required'] = 1;
$handler->display->display_options['filters']['search_api_views_fulltext']['fields'] = array(
'title' => 'title',
'body:value' => 'body:value',
'field_document_cat_field:field_document:file:name' => 'field_document_cat_field:field_document:file:name',
'field_document_cat_field:field_document:file:field_file_image_title_text' => 'field_document_cat_field:field_document:file:field_file_image_title_text',
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'advanced-search';
您可以尝试inline_entity_form或多字段模块。
相关链接:https://drupal.stackexchange.com/questions/81676/alternative-to-field-collection