From 505ead7d72765a01d023cfd75194e698e9dddd30 Mon Sep 17 00:00:00 2001 From: Francesco Sardara Date: Thu, 22 Nov 2018 11:19:52 +0100 Subject: [PATCH 1/2] ISAICP-4898: add more documents to trigger a sensible inverse document frequency in bundle boost search test. --- tests/features/joinup_search/search.feature | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/features/joinup_search/search.feature b/tests/features/joinup_search/search.feature index 4efa2b84fa..a3994a11a4 100644 --- a/tests/features/joinup_search/search.feature +++ b/tests/features/joinup_search/search.feature @@ -199,17 +199,17 @@ Feature: Global search | title | Bird outposts in the wild | | description | Exotic wings and where to find them. | | state | validated | - And collection: - | title | Ornithology: the study of birds | - | description | Ornithology is a branch of zoology. | - | state | validated | - | affiliates | Bird outposts in the wild | + And collections: + | title | description | state | affiliates | + | Ornithology: the study of birds | Ornithology is a branch of zoology. | validated | Bird outposts in the wild | + | Husky Flying Xylophone | A strange instrument. | validated | | And custom_page content: | title | body | collection | | Disturbed birds | Flocks of trained pigeons flying off. | Ornithology: the study of birds | And news content: - | title | body | collection | state | - | Chickens are small birds | Domesticated in India. | Ornithology: the study of birds | validated | + | title | body | collection | state | + | Chickens are small birds | Birds domesticated in India. | Ornithology: the study of birds | validated | + | Found a xylophone from 1600 in Asia | Oldest instrument of this type. | Husky Flying Xylophone | validated | And event content: | title | body | collection | state | | Bird spotting | Roosters crow at dawn. | Ornithology: the study of birds | validated | From 76d77a7e0bc7ad4f7e0b4724e50f2ce8102b16f0 Mon Sep 17 00:00:00 2001 From: Francesco Sardara Date: Thu, 22 Nov 2018 11:25:23 +0100 Subject: [PATCH 2/2] ISAICP-4898: reinstate edismax query parser to let Solr account for document boosts. --- web/modules/custom/joinup_search/joinup_search.module | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/modules/custom/joinup_search/joinup_search.module b/web/modules/custom/joinup_search/joinup_search.module index 20db62d750..314af525ea 100644 --- a/web/modules/custom/joinup_search/joinup_search.module +++ b/web/modules/custom/joinup_search/joinup_search.module @@ -165,12 +165,15 @@ function joinup_search_search_api_solr_field_mapping_alter(IndexInterface $index * Implements hook_search_api_solr_query_alter(). */ function joinup_search_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query): void { - if ( - !$solarium_query instanceof Query - ) { + if (!$solarium_query instanceof Query) { return; } + // Keep the edismax parser to allow document boosting to work properly. + // @todo remove when document boosting is reimplemented by search_api_solr + // @see https://webgate.ec.europa.eu/CITnet/jira/browse/ISAICP-4907 + $solarium_query->addParam('defType', 'edismax'); + /** @var \Drupal\search_api_field\Plugin\Field\FieldType\SearchItem $item */ if (!$item = $query->getOption('search_api_field item')) { return;