diff --git a/config/schema/facets.processor.schema.yml b/config/schema/facets.processor.schema.yml index 54f2740..cd012d6 100644 --- a/config/schema/facets.processor.schema.yml +++ b/config/schema/facets.processor.schema.yml @@ -98,3 +98,17 @@ plugin.plugin_configuration.facets_processor.hide_active_items_processor: plugin.plugin_configuration.facets_processor.list_item: type: config_object + +plugin.plugin_configuration.facets_processor.date_item: + type: mapping + label: 'Boolean processor' + mapping: + display_relative: + type: boolean + label: 'Display relative' + granularity: + type: integer + label: 'Granularity' + date_display: + type: string + label: 'Date display' diff --git a/src/Plugin/facets/query_type/SearchApiRange.php b/src/Plugin/facets/query_type/SearchApiRange.php index f1dba88..81e8b01 100644 --- a/src/Plugin/facets/query_type/SearchApiRange.php +++ b/src/Plugin/facets/query_type/SearchApiRange.php @@ -17,13 +17,6 @@ */ class SearchApiRange extends QueryTypePluginBase { - /** - * The backend's native query object. - * - * @var \Drupal\search_api\Query\QueryInterface - */ - protected $query; - /** * {@inheritdoc} */ diff --git a/src/Plugin/facets/query_type/SearchApiString.php b/src/Plugin/facets/query_type/SearchApiString.php index 27424a6..c9c7bf9 100644 --- a/src/Plugin/facets/query_type/SearchApiString.php +++ b/src/Plugin/facets/query_type/SearchApiString.php @@ -22,13 +22,6 @@ */ class SearchApiString extends QueryTypePluginBase { - /** - * The backend's native query object. - * - * @var \Drupal\search_api\Query\QueryInterface - */ - protected $query; - /** * {@inheritdoc} */ diff --git a/src/QueryType/QueryTypeRangeBase.php b/src/QueryType/QueryTypeRangeBase.php index fbc1302..e447861 100644 --- a/src/QueryType/QueryTypeRangeBase.php +++ b/src/QueryType/QueryTypeRangeBase.php @@ -37,7 +37,8 @@ public function execute() { foreach ($active_items as $value) { $range = $this->calculateRange($value); - $item_filter = $query->createConditionGroup($exclude ? 'OR' : 'AND', ['facet:' . $field_identifier]); + $conjunction = $exclude ? 'OR' : 'AND'; + $item_filter = $query->createConditionGroup($conjunction, ['facet:' . $field_identifier]); $item_filter->addCondition($this->facet->getFieldIdentifier(), $range['start'], $exclude ? '<' : '>='); $item_filter->addCondition($this->facet->getFieldIdentifier(), $range['stop'], $exclude ? '>' : '<='); diff --git a/tests/src/Functional/IntegrationTest.php b/tests/src/Functional/IntegrationTest.php index 3e6e7d4..1542a13 100644 --- a/tests/src/Functional/IntegrationTest.php +++ b/tests/src/Functional/IntegrationTest.php @@ -480,8 +480,9 @@ public function testExcludeFacetDate() { $form = [ 'widget' => 'links', - 'facet_settings[date_item][status]' => TRUE, - 'facet_settings[date_item][settings][display_relative]' => FALSE, + 'facet_settings[exclude]' => 0, + 'facet_settings[date_item][status]' => 1, + 'facet_settings[date_item][settings][display_relative]' => 0, 'facet_settings[date_item][settings][granularity]' => SearchApiDate::FACETAPI_DATE_MONTH, ]; $this->drupalGet($facet_edit_page); @@ -490,20 +491,19 @@ public function testExcludeFacetDate() { $this->drupalGet('search-api-test-fulltext'); $this->assertSession()->pageTextContains('foo old'); $this->assertSession()->pageTextContains('foo new'); - $this->clickLink('1490000000'); - $this->checkFacetIsActive('1490000000'); + $this->clickLink('March 2017'); + $this->checkFacetIsActive('March 2017'); $this->assertSession()->pageTextContains('foo new'); $this->assertSession()->pageTextNotContains('foo old'); $this->drupalGet($facet_edit_page); $this->assertSession()->checkboxNotChecked('edit-facet-settings-exclude'); - $form['facet_settings[exclude]'] = TRUE; - $this->drupalPostForm(NULL, $form, 'Save'); + $this->drupalPostForm(NULL, ['facet_settings[exclude]' => 1], 'Save'); $this->assertSession()->checkboxChecked('edit-facet-settings-exclude'); $this->drupalGet('search-api-test-fulltext'); - $this->clickLink('1490000000'); - $this->checkFacetIsActive('1490000000'); + $this->clickLink('March 2017'); + $this->checkFacetIsActive('March 2017'); $this->assertSession()->pageTextContains('foo old'); $this->assertSession()->pageTextNotContains('foo new'); }