Skip to content

Commit fc7d920

Browse files
committed
Fix AmpRedisClient pipeline + fix Doc
1 parent 6d3a675 commit fc7d920

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased v2.x]
88

9+
## [2.0.1]
10+
11+
### Fixed
12+
13+
- (doc) Fix GPS coordinate (should be longitude first)
14+
- `AmpRedisClient` pipeline not sequential
15+
916
## [2.0.0]
1017

1118
### Added
@@ -124,7 +131,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124131
First version
125132

126133
[Unreleased v2.x]: https://github.com/MacFJA/php-redisearch/compare/2.0.0...HEAD
127-
[1.0.0]: https://github.com/MacFJA/php-redisearch/releases/tag/2.0.0
134+
[2.0.1]: https://github.com/MacFJA/php-redisearch/compare/2.0.0...2.0.1
135+
[2.0.0]: https://github.com/MacFJA/php-redisearch/releases/tag/2.0.0
128136
[Unreleased v1.x]: https://github.com/MacFJA/php-redisearch/compare/1.4.0...1.x
129137
[1.4.0]: https://github.com/MacFJA/php-redisearch/compare/1.3.0...1.4.0
130138
[1.3.0]: https://github.com/MacFJA/php-redisearch/compare/1.2.0...1.3.0

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ $index->addDocumentFromArray([
9696
'firstname' => 'Joe',
9797
'lastname' => 'Doe',
9898
'age' => 30,
99-
'address' => '40.689247,-74.044502'
99+
'address' => '-74.044502,40.689247'
100100
]);
101101
```
102102

@@ -130,14 +130,14 @@ $query = $queryBuilder
130130
->addString('Doe')
131131
->addElement(
132132
new Negation(
133-
new GeoFacet(['address'], 40.589247, -74.044502, 40, GeoFilterOption::UNIT_KILOMETERS)
133+
new GeoFacet(['address'], -74.044502, 40.589247, 40, GeoFilterOption::UNIT_KILOMETERS)
134134
)
135135
)
136136
->addElement(new Optional(new Word('John')))
137137
->render();
138138

139139
// The value of $query is:
140-
// @age:[(17 +inf] Doe -@address:[40.589247 -74.044502 40.000000 km] ~John
140+
// @age:[(17 +inf] Doe -@address:[-74.044502 40.589247 40.000000 km] ~John
141141
```
142142

143143
### Pipeline

src/Redis/Client/AmpRedisClient.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
namespace MacFJA\RediSearch\Redis\Client;
2323

24-
use function Amp\Promise\all;
2524
use function Amp\Promise\wait;
2625
use Amp\Redis\Redis;
2726
use function function_exists;
@@ -39,7 +38,7 @@ private function __construct(Redis $redis)
3938
if (!static::supports($redis)) {
4039
throw new RuntimeException($this->getMissingMessage('Amp\Redis', false, [
4140
Redis::class => ['query'],
42-
], ['\\Amp\\Promise\\wait', '\\Amp\\Promise\\all']));
41+
], ['\\Amp\\Promise\\wait']));
4342
}
4443
$this->redis = $redis;
4544
}
@@ -65,19 +64,21 @@ public static function supports($redis): bool
6564
{
6665
return $redis instanceof Redis
6766
&& method_exists($redis, 'query')
68-
&& function_exists('\\Amp\\Promise\\wait')
69-
&& function_exists('\\Amp\\Promise\\all');
67+
&& function_exists('\\Amp\\Promise\\wait');
7068
}
7169

72-
protected function doPipeline(Command ...$commands): array
70+
public function pipeline(Command ...$commands): array
7371
{
7472
false === static::$disableNotice
7573
&& trigger_error('Warning, \\Amp\\Redis\\Redis don\'t use a real Redis Pipeline', E_USER_NOTICE);
7674

77-
return wait(all(
78-
array_map(function (Command $command) {
79-
return $this->redis->query($command->getId(), ...array_map('strval', $command->getArguments()));
80-
}, $commands)
81-
));
75+
return array_map(function (Command $command) {
76+
return $this->execute($command);
77+
}, $commands);
78+
}
79+
80+
protected function doPipeline(Command ...$commands): array
81+
{
82+
return [];
8283
}
8384
}

0 commit comments

Comments
 (0)