omure/scout-advanced-meilisearch
Composer 安装命令:
composer require omure/scout-advanced-meilisearch
包简介
Laravel Scout extension that allows to use meilisearch advanced features as well as has an extended collection driver for testing purposes.
README 文档
README
What this package provides
Extended scout query builder
Added next changes to the basic query builder:
where('column', '<=', $value)- extended where, which supports 3 optional parameters for comparison. Two parameters are also allowed.where(Clusure $query)- where can take a closure as the first parameter in order to group queries (the same fororWhere)whereBetween('column', [$value1, $value2])whereNotIn('column', [$value1, $value2, $value3])- All where clauses have or variant:
orWhere,orWhereIn, etc
Two scout drivers
The drivers are compatible with the new scout builder.
- meilisearch_advanced
- collection_advanced
meilisearch_advanced
Uses all the advantages of meilisearch for comparison the results, searching in indexed arrays.
Also fixes an issue with the calculation of the total number of values.
(The current implementation requests the entire dataset in case scout builder has ->query() method used)
collection_advanced
The driver imitates how meilisearch work and completely relies on collections. It should be used only for tests as the whole searchable models data is in memory. The driver allows testing filtering and sorting as well as Extended scout builder features.
Meilisearch specific are taken into account
Meilisearch requires updating indexes filterable, sortable and searchable attributes in order to save the indexing data properly.
This package provides MeiliSearch facade that has updateIndexSettings method that handles that automatically.
How to use?
- In
config/scout.phpset'driver'tomeilisearch_advancedorcollection_advanced - Apply Searchable trait to the model (
Omure\ScoutAdvancedMeilisearch\Searchable); - For proper handling of the model, implement
Omure\ScoutAdvancedMeilisearch\Interfaces\MeiliSearchSearchableModelinterface to the model - Describe indexed parameters for searching in
toSearchableArray()method of the model (the same way as Scout does) - Specify searchable, filterable and sortable attributes by defining the next list of methods on the model:
getSearchableAttributes()- for usingsearch()statementsgetFilterableAttributes()- for usingwhere(), includingwhereIn,whereNotIn, etc. statementsgetSortableAttributes()- for usingorderBy()statementgetTypoToleranceSettings()- for typo tolerance All methods should return an array of strings which are the names of the parameters specified intoSearchableArray().
If you change the methods getSearchableAttributes(), getFilterableAttributes(), or getSortableAttributes()
returned indexes, you have to let meilisearch know about the changes. For that purpose use the facade:
MeiliSearch::updateIndexSettings(new User());
The method takes a model instance to update the parameters on the meilisearch server.
Keep in mind that toSearchableArray() doesn't have to have the same indexes as the database column names.
You can specify your own logic for searching and filtering. Use the specified parameters in your Scout Builder.
omure/scout-advanced-meilisearch 适用场景与选型建议
omure/scout-advanced-meilisearch 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.87k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2022 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「search」 「laravel」 「scout」 「meilisearch」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omure/scout-advanced-meilisearch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omure/scout-advanced-meilisearch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omure/scout-advanced-meilisearch 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Elastic Driver for Laravel Scout
Abstraction Layer to index and search entities
Scout support for MoonShine
Pimcore 10.x Website Indexer (powered by Zend Search Lucene)
统计信息
- 总下载量: 3.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-24