#1791 removed terms thesaurus without parents from search form autocomplete
This commit is contained in:
parent
d1b4902aa3
commit
1993f80d8d
|
@ -73,6 +73,14 @@ field_settings:
|
||||||
dependencies:
|
dependencies:
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- taxonomy
|
||||||
|
parent:
|
||||||
|
label: 'Parents du terme'
|
||||||
|
datasource_id: 'entity:taxonomy_term'
|
||||||
|
property_path: parent
|
||||||
|
type: integer
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- taxonomy
|
||||||
status:
|
status:
|
||||||
label: Published
|
label: Published
|
||||||
datasource_id: 'entity:taxonomy_term'
|
datasource_id: 'entity:taxonomy_term'
|
||||||
|
@ -97,6 +105,14 @@ field_settings:
|
||||||
dependencies:
|
dependencies:
|
||||||
module:
|
module:
|
||||||
- taxonomy
|
- taxonomy
|
||||||
|
vid:
|
||||||
|
label: Vocabulaire
|
||||||
|
datasource_id: 'entity:taxonomy_term'
|
||||||
|
property_path: vid
|
||||||
|
type: string
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- taxonomy
|
||||||
datasource_settings:
|
datasource_settings:
|
||||||
'entity:taxonomy_term':
|
'entity:taxonomy_term':
|
||||||
bundles:
|
bundles:
|
||||||
|
@ -113,6 +129,7 @@ processor_settings:
|
||||||
add_url: { }
|
add_url: { }
|
||||||
aggregated_field: { }
|
aggregated_field: { }
|
||||||
entity_status: { }
|
entity_status: { }
|
||||||
|
entity_type: { }
|
||||||
language_with_fallback: { }
|
language_with_fallback: { }
|
||||||
rendered_item: { }
|
rendered_item: { }
|
||||||
solr_date_range:
|
solr_date_range:
|
||||||
|
|
|
@ -54,6 +54,21 @@ class FormAutocomplete extends ControllerBase {
|
||||||
// Add sorting.
|
// Add sorting.
|
||||||
$query->sort('search_api_relevance', 'DESC');
|
$query->sort('search_api_relevance', 'DESC');
|
||||||
|
|
||||||
|
// remove thesaurus tags without parents (main categories)
|
||||||
|
$parents_conditions = $query->createConditionGroup('OR');
|
||||||
|
// tags
|
||||||
|
$tags_conditions = $query->createConditionGroup('AND');
|
||||||
|
$tags_conditions->addCondition('vid', 'tags');
|
||||||
|
$parents_conditions->addConditionGroup($tags_conditions);
|
||||||
|
// OR thesaurus & has parent
|
||||||
|
$thesaurus_conditions = $query->createConditionGroup('AND');
|
||||||
|
$thesaurus_conditions->addCondition('vid', 'thesaurus');
|
||||||
|
$thesaurus_conditions->addCondition('parent', 0, '<>');
|
||||||
|
$parents_conditions->addConditionGroup($thesaurus_conditions);
|
||||||
|
|
||||||
|
$query->addConditionGroup($parents_conditions);
|
||||||
|
|
||||||
|
|
||||||
// Set one or more tags for the query.
|
// Set one or more tags for the query.
|
||||||
// @see hook_search_api_query_TAG_alter()
|
// @see hook_search_api_query_TAG_alter()
|
||||||
// @see hook_search_api_results_TAG_alter()
|
// @see hook_search_api_results_TAG_alter()
|
||||||
|
|
Loading…
Reference in New Issue