biblioonline/sphinxsearch-l5
Composer 安装命令:
composer require biblioonline/sphinxsearch-l5
包简介
Laravel package to query Sphinxsearch in Laravel 5
README 文档
README
Simple Laravel 5 package for make queries to Sphinx Search. Inspired by scalia/sphinxsearch package for Laravel 4.
This package was created to import to the site packagist.org and allow installation through Composer (https://getcomposer.org/).
Installation
Require this package in your composer.json:
"require": { /*** Some others packages ***/ "sngrl/sphinxsearch": "dev-master", },
Run in your console composer update command to pull down the latest version of Sphinx Search.
Or just run this in console:
composer require sngrl/sphinxsearch:dev-master
After updating composer, add the ServiceProvider to the "providers" array in config/app.php:
'providers' => array( /*** Some others providers ***/ sngrl\SphinxSearch\SphinxSearchServiceProvider::class, ),
You can add this line to the files, where you may use SphinxSearch:
use sngrl\SphinxSearch\SphinxSearch;
Configuration
To use Sphinx Search, you need to configure your indexes and what model it should query. To do so, publish the configuration into your app.
php artisan vendor:publish --provider=sngrl\SphinxSearch\SphinxSearchServiceProvider --force
This will create the file config/sphinxsearch.php. Modify as needed the host and port, and configure the indexes, binding them to a table and id column.
return array ( 'host' => '127.0.0.1', 'port' => 9312, 'indexes' => array ( 'my_index_name' => array ( 'table' => 'my_keywords_table', 'column' => 'id' ), ) );
Or disable the model querying to just get a list of result id's.
return array ( 'host' => '127.0.0.1', 'port' => 9312, 'indexes' => array ( 'my_index_name' => FALSE, ) );
Usage
Basic query (raw sphinx results)
$sphinx = new SphinxSearch(); $results = $sphinx->search('my query', 'index_name')->query();
Basic query (with Eloquent)
$results = $sphinx->search('my query', 'index_name')->get();
Query another Sphinx index with limit and filters.
$results = $sphinx->search('my query', 'index_name') ->limit(30) ->filter('attribute', array(1, 2)) ->range('int_attribute', 1, 10) ->get();
Query with match and sort type specified.
$result = $sphinx->search('my query', 'index_name') ->setFieldWeights( array( 'partno' => 10, 'name' => 8, 'details' => 1 ) ) ->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_EXTENDED) ->setSortMode(\Sphinx\SphinxClient::SPH_SORT_EXTENDED, "@weight DESC") ->get(true); //passing true causes get() to respect returned sort order
License
Sngrl Sphinx Search is open-sourced software licensed under the MIT license
biblioonline/sphinxsearch-l5 适用场景与选型建议
biblioonline/sphinxsearch-l5 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.54k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「sphinx」 「sphinxsearch」 「laravel 5」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 biblioonline/sphinxsearch-l5 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 biblioonline/sphinxsearch-l5 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 biblioonline/sphinxsearch-l5 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel query builder for SphinxQL
A Sphinx Query Builder extension for the Laravel Database package
Sphinx Search PHP API
ShopExpress SphinxSearchClient API for pdo-crud service
Laravel package to query Sphinxsearch in Laravel 8
Sphinx search bundle for Symfony 2
统计信息
- 总下载量: 4.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-30