We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make Geo field sortable in MacFJA / php-redisearch library?
The text was updated successfully, but these errors were encountered:
With the version 2.0.0 (that was not possible with version 1.x of the lib):
2.0.0
1.x
use MacFJA\RediSearch\Index; use MacFJA\RediSearch\IndexBuilder; use MacFJA\RediSearch\Redis\Client\PredisClient; use MacFJA\RediSearch\Redis\Command\CreateCommand\GeoFieldOption; use MacFJA\RediSearch\Redis\Command\Search; use Predis\Client; $client = PredisClient::make(new Client(['scheme' => 'tcp', 'host' => 'localhost', 'port' => '6379', 'db' => 0])); // Or whatever client you need/have // Or $client = (new \MacFJA\RediSearch\Redis\Client\ClientFacade)->getClient($redisInstance); $indexBuilder = new IndexBuilder(); $indexBuilder ->setIndex('place') ->addPrefixes('p-') ->addField( (new GeoFieldOption()) ->setField('gps') ->setSortable(true) ); $indexBuilder->create($client); $index = new Index('place', $client); $index->addDocumentFromArray(['gps' => '-0.1277583,51.5073509'], 'p-london'); $index->addDocumentFromArray(['gps' => '2.3522219,48.856614'], 'p-paris'); $index->addDocumentFromArray(['gps' => '11.5819806,48.1351253'], 'p-munich'); $index->addDocumentFromArray(['gps' => '-74.005941,40.712784'], 'p-nyc'); $index->addDocumentFromArray(['gps' => '139.731992,35.709026'], 'p-tokyo'); $result = $client->execute( (new Search()) ->setIndex('place') ->setQuery('*') ->setSortBy('gps', 'DESC') ); var_dump($result);
Sorry, something went wrong.
I am not able to install Version 2.0.0 of this library using the following command? composer require macfja/redisearch
composer require macfja/redisearch
The package is available on Packagist: https://packagist.org/packages/macfja/redisearch#2.0.0
You need to have:
No branches or pull requests
How to make Geo field sortable in MacFJA / php-redisearch library?
The text was updated successfully, but these errors were encountered: