Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Classes/Domain/Search/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ protected function addConfiguredFilters(SearchRequestInterface $searchRequest)

ArrayUtility::mergeRecursiveWithOverrule(
$filter,
$this->configuration->get('searching.filter'),
true,
false
$this->configuration->get('searching.filter')
);

$searchRequest->setFilter($filter);
Expand Down
1 change: 1 addition & 0 deletions Documentation/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Changelog
changelog/20180308-131-respect-page-cache-clear
changelog/20180308-introduce-php70-type-hints
changelog/20180306-120-facet-configuration
changelog/20180926-163-allow-zero-as-typoscript-filter-value
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Bugfix 163 "It's not possible to configure a filter via TS with value 0 - zero"
===============================================================================

Prior to the change it was not possible to define a filter while searching, via
TypoScript, with the value `0`. `0` was filtered as empty value.

Now the configured filter is no longer filtered, it's up to the integrator to provide
proper configuration. Therefore `0` is now a valid and respected filter value.

See :issue:`163`.
4 changes: 2 additions & 2 deletions Documentation/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.0.6'
version = u'0.0.7'
# The full version, including alpha/beta/rc tags.
release = u'0.0.6'
release = u'0.0.7'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
Expand Down
2 changes: 1 addition & 1 deletion Documentation/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Composer

The extension can be installed through composer::

composer require "codappix/search_core" "~0.0.6"
composer require "codappix/search_core" "~0.0.7"

Note that you have to allow unstable packages:

Expand Down
29 changes: 14 additions & 15 deletions Tests/Unit/Domain/Search/SearchServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function configuredFilterAreAddedToRequestWithoutAnyFilter()
/**
* @test
*/
public function configuredFilterAreAddedToRequestWithExistingFilter()
public function configuredFilterWithValueZeroAreAddedToRequestWithoutAnyFilter()
{
$this->configuration->expects($this->any())
->method('getIfExists')
Expand All @@ -176,42 +176,44 @@ public function configuredFilterAreAddedToRequestWithExistingFilter()
$this->configuration->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls(
['property' => 'something'],
['property' => '0'],
$this->throwException(new InvalidArgumentException)
));

$this->connection->expects($this->once())
->method('search')
->with($this->callback(function ($searchRequest) {
return $searchRequest->getFilter() === [
'anotherProperty' => 'anything',
'property' => 'something',
];
return $searchRequest->getFilter() === ['property' => '0'];
}))
->willReturn($this->getMockBuilder(SearchResultInterface::class)->getMock());

$searchRequest = new SearchRequest('SearchWord');
$searchRequest->setFilter(['anotherProperty' => 'anything']);
$this->subject->search($searchRequest);
}

/**
* @test
*/
public function nonConfiguredFilterIsNotChangingRequestWithExistingFilter()
public function configuredFilterAreAddedToRequestWithExistingFilter()
{
$this->configuration->expects($this->any())
->method('getIfExists')
->withConsecutive(['searching.size'], ['searching.facets'])
->will($this->onConsecutiveCalls(null, null));
$this->configuration->expects($this->any())
->method('get')
->will($this->throwException(new InvalidArgumentException));
->will($this->onConsecutiveCalls(
['property' => 'something'],
$this->throwException(new InvalidArgumentException)
));

$this->connection->expects($this->once())
->method('search')
->with($this->callback(function ($searchRequest) {
return $searchRequest->getFilter() === ['anotherProperty' => 'anything'];
return $searchRequest->getFilter() === [
'anotherProperty' => 'anything',
'property' => 'something',
];
}))
->willReturn($this->getMockBuilder(SearchResultInterface::class)->getMock());

Expand All @@ -223,18 +225,15 @@ public function nonConfiguredFilterIsNotChangingRequestWithExistingFilter()
/**
* @test
*/
public function emptyConfiguredFilterIsNotChangingRequestWithExistingFilter()
public function nonConfiguredFilterIsNotChangingRequestWithExistingFilter()
{
$this->configuration->expects($this->any())
->method('getIfExists')
->withConsecutive(['searching.size'], ['searching.facets'])
->will($this->onConsecutiveCalls(null, null));
$this->configuration->expects($this->any())
->method('get')
->will($this->onConsecutiveCalls(
['anotherProperty' => ''],
$this->throwException(new InvalidArgumentException)
));
->will($this->throwException(new InvalidArgumentException));

$this->connection->expects($this->once())
->method('search')
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
],
'state' => 'beta',
'version' => '0.0.6',
'version' => '0.0.7',
'author' => 'Daniel Siepmann',
'author_email' => 'coding@daniel-siepmann.de',
];