Skip to content
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Correclty handle Search result with NoContent flag ([Issue#9], [Issue#10], [PR#13])
- Don't double % in fuzzy search ([Issue#11], [PR#14])
- Fix exact match not used inside text facet ([Issue#12], [PR#15])

## [1.3.0]

Expand Down Expand Up @@ -110,8 +111,10 @@ First version
[Issue#9]: https://github.com/MacFJA/php-redisearch/issues/9
[Issue#10]: https://github.com/MacFJA/php-redisearch/issues/10
[Issue#11]: https://github.com/MacFJA/php-redisearch/issues/11
[Issue#12]: https://github.com/MacFJA/php-redisearch/issues/12
[PR#1]: https://github.com/MacFJA/php-redisearch/pull/1
[PR#3]: https://github.com/MacFJA/php-redisearch/pull/3
[PR#8]: https://github.com/MacFJA/php-redisearch/pull/8
[PR#13]: https://github.com/MacFJA/php-redisearch/pull/13
[PR#14]: https://github.com/MacFJA/php-redisearch/pull/14
[PR#14]: https://github.com/MacFJA/php-redisearch/pull/14
[PR#15]: https://github.com/MacFJA/php-redisearch/pull/15
5 changes: 5 additions & 0 deletions src/Search/QueryBuilder/ExactMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use MacFJA\RediSearch\Helper\EscapeHelper;
use function sprintf;
use function strpos;

class ExactMatch implements PartialQuery
{
Expand All @@ -36,6 +37,10 @@ public function __construct(string $match)

public function render(): string
{
if (false === strpos($this->match, ' ')) {
return EscapeHelper::escapeWord($this->match);
}

return sprintf('"%s"', EscapeHelper::escapeExactMatch($this->match));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Search/QueryBuilder/TextFacet.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function render(): string
{
if (count($this->orValues) > 1) {
$terms = OrGroup::renderNoParentheses(...array_map(function (string $orValue) {
return new Word($orValue);
return new ExactMatch($orValue);
}, $this->orValues));

return sprintf(self::WITH_SPACE_PATTERN, EscapeHelper::escapeFieldName($this->field), $terms);
Expand Down