Installed:
Search API: 7.x-1.11
Search API Entity Translation:7.x-2.x-dev
Views: 7.x-3.7
Database search : 7.x-1.2
I am trying to create a view from a search index that I created.
The problem that I am having is that I get multiple duplicate values returned.
Mostly people have this issue if they have fields in their content types which are multi value fields. Mine does not. My problem arises when I expose the filter criteria. I get an extra duplicated node returned for each filter criteria that is exposed.
I have tried this with other content types I just created to test this error and views to accompany those content types. I get duplicate results when exposing the filters.
This seems like a bug to me, as this is standard use for this module.
If this is not a bug please tell me what I am doing wrong. Thank you.
I have the export of the view at the end of this issue report (to not clutter things up)
Here is my content type
Label = Title FieldType: Text field
Label = Study Number FieldType: Text field
Label = Language FieldType: Language selection
Label = Year Published FieldType: Term reference Select list
Label = Country FieldType: Term reference Select list
Label = Author FieldType: Long text Text area (multiple rows)
Label = Abstract FieldType: Long text Text area (multiple rows)
Label = Main results and conclusions FieldType: Long text and summary Text area with a summary
Label = Works Cited FieldType: Long text Text area (multiple rows)
Here is my view definition
$view = new view();
$view->name = 'search_the_mangroves';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_default_multilingual_node_index';
$view->human_name = 'Search The Mangroves';
$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'] = 'Search The Mangroves';
$handler->display->display_options['use_more_always'] = FALSE;
$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['query']['options']['search_api_bypass_access'] = 0;
$handler->display->display_options['query']['options']['parse_mode'] = 'single';
$handler->display->display_options['exposed_form']['type'] = 'better_exposed_filters';
$handler->display->display_options['exposed_form']['options']['bef'] = array(
'general' => array(
'allow_secondary' => 0,
'secondary_label' => 'Advanced options',
),
'search_api_views_fulltext' => array(
'more_options' => array(
'is_secondary' => 0,
'bef_filter_description' => 'Enter any text or choose from the "threats" suggestions',
'tokens' => array(
'available' => array(
0 => 'global_types',
),
),
),
),
'field_countries' => array(
'more_options' => array(
'is_secondary' => 0,
'bef_filter_description' => '',
'tokens' => array(
'available' => array(
0 => 'global_types',
),
),
),
),
'field_year_published' => array(
'more_options' => array(
'is_secondary' => 0,
'bef_filter_description' => '',
'tokens' => array(
'available' => array(
0 => 'global_types',
),
),
),
),
);
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['row_class'] = 'thumbnail2 col-xs-4';
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['row_plugin'] = 'entity';
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = '<div class="text-center"><b><h1>No Results Found</h1></b></div>';
$handler->display->display_options['empty']['area']['format'] = 'full_html';
/* Field: Indexed Multilingual Node: Multilingual ID */
$handler->display->display_options['fields']['search_api_et_id']['id'] = 'search_api_et_id';
$handler->display->display_options['fields']['search_api_et_id']['table'] = 'search_api_index_default_multilingual_node_index';
$handler->display->display_options['fields']['search_api_et_id']['field'] = 'search_api_et_id';
/* 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_default_multilingual_node_index';
$handler->display->display_options['filters']['search_api_views_fulltext']['field'] = 'search_api_views_fulltext';
$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'] = 'Fulltext search';
$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']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
$handler->display->display_options['filters']['search_api_views_fulltext']['min_length'] = '4';
/* Filter criterion: Indexed Multilingual Node: Content type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'search_api_index_default_multilingual_node_index';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'mangrove_article' => 'mangrove_article',
);
/* Filter criterion: Indexed Multilingual Node: Country */
$handler->display->display_options['filters']['field_countries']['id'] = 'field_countries';
$handler->display->display_options['filters']['field_countries']['table'] = 'search_api_index_default_multilingual_node_index';
$handler->display->display_options['filters']['field_countries']['field'] = 'field_countries';
$handler->display->display_options['filters']['field_countries']['value'] = array();
$handler->display->display_options['filters']['field_countries']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_countries']['expose']['operator_id'] = 'field_countries_op';
$handler->display->display_options['filters']['field_countries']['expose']['label'] = 'Country';
$handler->display->display_options['filters']['field_countries']['expose']['operator'] = 'field_countries_op';
$handler->display->display_options['filters']['field_countries']['expose']['identifier'] = 'field_countries';
$handler->display->display_options['filters']['field_countries']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
$handler->display->display_options['filters']['field_countries']['expose']['reduce'] = 0;
/* Filter criterion: Indexed Multilingual Node: Year Published */
$handler->display->display_options['filters']['field_year_published']['id'] = 'field_year_published';
$handler->display->display_options['filters']['field_year_published']['table'] = 'search_api_index_default_multilingual_node_index';
$handler->display->display_options['filters']['field_year_published']['field'] = 'field_year_published';
$handler->display->display_options['filters']['field_year_published']['value'] = array();
$handler->display->display_options['filters']['field_year_published']['exposed'] = TRUE;
$handler->display->display_options['filters']['field_year_published']['expose']['operator_id'] = 'field_year_published_op';
$handler->display->display_options['filters']['field_year_published']['expose']['label'] = 'Year Published';
$handler->display->display_options['filters']['field_year_published']['expose']['operator'] = 'field_year_published_op';
$handler->display->display_options['filters']['field_year_published']['expose']['identifier'] = 'field_year_published';
$handler->display->display_options['filters']['field_year_published']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
3 => 0,
);
$handler->display->display_options['filters']['field_year_published']['expose']['reduce'] = 0;
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'searchthemangroves';
Comments
Comment #1
davidpugh CreditAttribution: davidpugh commentedComment #2
drunken monkeyThis could be expected behavior. When using Search API Entity Translation, each indexed item (node, in this case) will be split into separate items for each language it exists in. If you create a search but don't include any (fixed, exposed or contextual) filter on the item language, the same item might be returned several times, for different languages. (They will probably all be rendered in the current page language, though, so will appear identical.)
However, this should be completely independent of whether you expose filters, so I'm not sure of the causality there.
Anyways, please check whether this is indeed the cause of your problems and, if so, explain what you like to be changed. (Also, move the issue to the Search API Entity Translation queue in that case.)
Comment #3
legolasboThis issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.