当前位置: 首页 > news >正文

php meilisearch demo

# 创建一个meilisearch 使用完自动销毁
docker run -itd --rm -p 7700:7700 getmeili/meilisearch:v1.3

docker-compose 参数

version: "3"
networks:flyserver:driver: bridge
services:search:image: getmeili/meilisearch:v1.3restart: alwaysenvironment:- MEILI_MASTER_KEY=masterKeyports:- "7700:7700"networks:- flyserveruser: roottty: true
<?phprequire_once __DIR__ . '/vendor/autoload.php';use Meilisearch\Client;$client = new Client('http://127.0.0.1:7700', 'masterKey');# An index is where the documents are stored.
$index = $client->index('movies');$documents = [['id' => 1,  'title' => 'Carol', 'genres' => ['Romance, Drama']],['id' => 2,  'title' => 'Wonder Woman', 'genres' => ['Action, Adventure']],['id' => 3,  'title' => 'Life of Pi', 'genres' => ['Adventure, Drama']],['id' => 4,  'title' => 'Mad Max: Fury Road', 'genres' => ['Adventure, Science Fiction']],['id' => 5,  'title' => 'Moana', 'genres' => ['Fantasy, Action']],['id' => 6,  'title' => 'Philadelphia', 'genres' => ['Drama']],["id" => 7, "title" => "fiy", "genres" => ["01","02"]],["id" => 8, "title" => "fiy", "genres" => ["03","04"]],
];# If the index 'movies' does not exist, Meilisearch creates it when you first add the documents.
$index->addDocuments($documents); // => { "uid": 0 }$index->updateFilterableAttributes(['id','genres']);$search = $index->search('fiy',['filter' => ['id > 2', "genres = '01'"]]);print_r($search->getHits());
http://www.lryc.cn/news/113831.html

相关文章:

  • 芒格之道——查理·芒格股东会讲话1987-2022
  • 如何运营手游联运平台游戏?
  • vscode连接远程Linux服务器
  • numpy 转换成 cupy 利用GPU执行 错误
  • 力扣:55. 跳跃游戏(Python3)
  • Unity 编辑器资源导入处理函数 OnPreprocessAudio :深入解析与实用案例
  • mongodb-win32-x86_64-2008plus-3.4.24-signed.msi
  • java的反射
  • MySQL — InnoDB 锁
  • 首批获得金融级行业云平台认证,天翼云深耕行业云
  • 浅谈Python解释器的组成
  • 服务限流治理
  • 机器学习笔记 - 使用CLIP在没有数据的情况下创建图像分类器
  • 42.利用 牛顿迭代法解非线性高维方程组(matlab程序)
  • 我在leetcode用动态规划炒股
  • rust实践-异步并发socket通信
  • SolidUI社区-根据Prompt打造人设
  • 设计模式行为型——观察者模式
  • Kernel Exception导致手机重启案例分析
  • C++入门篇5---模板
  • L2CS-Net: 3D gaze estimation
  • kenernetes/k8s笔试面试
  • 我们真的是在做数据治理吗
  • 聊聊汽车电子的话题
  • ThinkPHP6企业OA办公系统
  • PPS Tester测量原理和实施方法
  • 浅谈新电改背景下电网企业综合能源服务商业模式研究及发展方向
  • SpringBoot + Docker 实现一次构建到处运行~
  • clang-format格式化代码
  • 品牌宣传与媒体传播是声誉管理的主要方式之一