|
48 | 48 | * @uses \MacFJA\RediSearch\Redis\Command\CreateCommand\GeoFieldOption |
49 | 49 | * @uses \MacFJA\RediSearch\Redis\Command\CreateCommand\NumericFieldOption |
50 | 50 | * @uses \MacFJA\RediSearch\Redis\Command\CreateCommand\TagFieldOption |
| 51 | + * @uses \MacFJA\RediSearch\Redis\Command\CreateCommand\JSONFieldOption |
51 | 52 | * @uses \MacFJA\RediSearch\Redis\Command\Option\DecoratedOptionAwareTrait |
52 | 53 | * @uses \MacFJA\RediSearch\Redis\Command\Option\GroupedOption |
53 | 54 | * @uses \MacFJA\RediSearch\Redis\Command\Option\WithPublicGroupedSetterTrait |
@@ -252,6 +253,45 @@ public function testAllAdd(): void |
252 | 253 | static::assertEquals($createCommand, $builder->getCommand()); |
253 | 254 | } |
254 | 255 |
|
| 256 | + public function testAllJsonAdd(): void |
| 257 | + { |
| 258 | + $createCommand = new Create(); |
| 259 | + |
| 260 | + $builder = new IndexBuilder(); |
| 261 | + |
| 262 | + $builder->setIndex('city'); |
| 263 | + $createCommand->setIndex('city'); |
| 264 | + |
| 265 | + $oldBuilder = $builder; |
| 266 | + $builder = $builder->addPrefixes('city-', 'c-'); |
| 267 | + static::assertNotEquals($createCommand, $builder->getCommand()); |
| 268 | + $createCommand->setPrefixes('city-', 'c-'); |
| 269 | + static::assertEquals($createCommand, $builder->getCommand()); |
| 270 | + static::assertSame($oldBuilder, $builder); |
| 271 | + |
| 272 | + $builder->addStopWords('hello', 'world'); |
| 273 | + $createCommand->setStopWords('hello', 'world'); |
| 274 | + |
| 275 | + $builder->addJSONField('$.city.name', (new TextFieldOption())->setField('name')); |
| 276 | + $createCommand->addJSONTextField('$.city.name', 'name'); |
| 277 | + |
| 278 | + $builder->addJSONField('$.city.country', (new TextFieldOption())->setField('country')); |
| 279 | + $createCommand->addJSONTextField('$.city.country', 'country'); |
| 280 | + |
| 281 | + $builder->addJSONTextField('$.city.continent', 'continent'); |
| 282 | + $createCommand->addJSONTextField('$.city.continent', 'continent'); |
| 283 | + |
| 284 | + $builder->addJSONNumericField('$.city.population', 'population'); |
| 285 | + $createCommand->addJSONNumericField('$.city.population', 'population'); |
| 286 | + |
| 287 | + $builder->addJSONGeoField('$.city.gps', 'gps'); |
| 288 | + $createCommand->addJSONGeoField('$.city.gps', 'gps'); |
| 289 | + |
| 290 | + $builder->addJSONTagField('$.city.languages', 'languages'); |
| 291 | + $createCommand->addJSONTagField('$.city.languages', 'languages'); |
| 292 | + static::assertEquals($createCommand, $builder->getCommand()); |
| 293 | + } |
| 294 | + |
255 | 295 | /** |
256 | 296 | * @medium |
257 | 297 | */ |
|
0 commit comments