当前位置: 首页 > 工具软件 > RediSearch > 使用案例 >

PHP redisearch的使用

微生阳平
2023-12-01

 下载PHP redisearch

composer require macfja/redisearch

这个客户端支持redis扩展 ,predis等

GitHub - MacFJA/php-redisearch: PHP Client for RediSearch

https://redis.io/commands/ft.create/

我这里命令执行创建索引

ft.CREATE userIdx ON HASH PREFIX 1 {user}:id: SCHEMA city TEXT id NUMERIC nickname TEXT mobile TEXT address GEO status TAG  dispatch_status TAG SORTABLE NOINDEX push_token text

初始化客户端

$clientFacade = new \MacFJA\RediSearch\Redis\Client\ClientFacade();

// With Predis
$client = $clientFacade->getClient(new \Predis\Client(/* ... */));

// With Phpredis extension
$client = $clientFacade->getClient(new \Redis([/* ... */]));

/
 类似资料: