File tree 4 files changed +11
-4
lines changed
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
### Fixed
14
14
15
15
- Correclty handle Search result with NoContent flag ([ Issue #9 ] , [ Issue #10 ] , [ PR #13 ] )
16
+ - Fix exact match not used inside text facet ([ Issue #12 ] , [ PR #15 ] )
16
17
17
18
## [ 1.3.0]
18
19
@@ -108,7 +109,9 @@ First version
108
109
[ Issue#2 ] : https://github.com/MacFJA/php-redisearch/issues/2
109
110
[ Issue#9 ] : https://github.com/MacFJA/php-redisearch/issues/9
110
111
[ Issue#10 ] : https://github.com/MacFJA/php-redisearch/issues/10
112
+ [ Issue#12 ] : https://github.com/MacFJA/php-redisearch/issues/12
111
113
[ PR#1 ] : https://github.com/MacFJA/php-redisearch/pull/1
112
114
[ PR#3 ] : https://github.com/MacFJA/php-redisearch/pull/3
113
115
[ PR#8 ] : https://github.com/MacFJA/php-redisearch/pull/8
114
- [ PR#13 ] : https://github.com/MacFJA/php-redisearch/pull/13
116
+ [ PR#13 ] : https://github.com/MacFJA/php-redisearch/pull/13
117
+ [ PR#15 ] : https://github.com/MacFJA/php-redisearch/pull/15
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ class Search implements Builder, Pipeable
110
110
private $ highlight ;
111
111
112
112
/** @var null|int */
113
- private $ slop = null ;
113
+ private $ slop ;
114
114
115
115
/** @var bool */
116
116
private $ inOrder = false ;
@@ -327,7 +327,6 @@ public function withSlop(int $slop = 0): Search
327
327
return $ this ;
328
328
}
329
329
330
-
331
330
public function withInOrder (bool $ inOrder = true ): Search
332
331
{
333
332
$ this ->inOrder = $ inOrder ;
Original file line number Diff line number Diff line change 23
23
24
24
use MacFJA \RediSearch \Helper \EscapeHelper ;
25
25
use function sprintf ;
26
+ use function strpos ;
26
27
27
28
class ExactMatch implements PartialQuery
28
29
{
@@ -36,6 +37,10 @@ public function __construct(string $match)
36
37
37
38
public function render (): string
38
39
{
40
+ if (false === strpos ($ this ->match , ' ' )) {
41
+ return EscapeHelper::escapeWord ($ this ->match );
42
+ }
43
+
39
44
return sprintf ('"%s" ' , EscapeHelper::escapeExactMatch ($ this ->match ));
40
45
}
41
46
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function render(): string
53
53
{
54
54
if (count ($ this ->orValues ) > 1 ) {
55
55
$ terms = OrGroup::renderNoParentheses (...array_map (function (string $ orValue ) {
56
- return new Word ($ orValue );
56
+ return new ExactMatch ($ orValue );
57
57
}, $ this ->orValues ));
58
58
59
59
return sprintf (self ::WITH_SPACE_PATTERN , EscapeHelper::escapeFieldName ($ this ->field ), $ terms );
You can’t perform that action at this time.
0 commit comments