phoogkamer/cloudsearch-wrapper
最新稳定版本:1.0.0
Composer 安装命令:
composer require phoogkamer/cloudsearch-wrapper
包简介
关键字:
README 文档
README
A wrapper for the AWS SDK regarding CloudSearch. Provides a nicer, less error prone interface than the Amazon SDK for CloudSearch. Version 0.3.0 should be considered stable. I'm just not sure if the featureset is complete enough for a major version change.
Installation
composer require phoogkamer/cloudsearch-wrapper:0.3.*
Example usage
Below is a simple search example.
$client = new CloudSearchClient($endpoint, $key, $secret); $query = new CloudSearchStructuredQuery(); //Adds a field (id:1) $query->addField('id', 1); //Will give max 15 results $query->setSize(15); //Currently $result is still the standard AWS SDK result $result = $client->search($query);
You will most probably need something more advanced, like with And and Or statements. This is done like so:
$query->addAnd(function(CloudSearchStructuredQuery $query) { $query->addOr(function(CloudSearchStructuredQuery $query) { //Add string by setting the second parameter true $query->addField('title', 'Forged Alliance', true); $query->addField('title', 'Supreme Commander', true); }); $query->addOr(function(CloudSearchStructuredQuery $query) { $query->addField('id', 1); //Gets everything within a range from 2 to 5 $query->addRangeField('id', 2, 5); }); });
Note that it's easy to nest in an elegant way.
统计信息
- 总下载量: 21.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-29