承接 tamayo/stretchy 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tamayo/stretchy

Composer 安装命令:

composer require tamayo/stretchy

包简介

Elastic Search integration for Laravel 5.0

README 文档

README

Build Status

Stretchy in an Elasticsearch integration for Laravel 5.

Heavily Inspired by Query Builder and Schema of laravel.

Description on going.

Version

2.0.0 - Alpha

Documentation

The current documentation is at stretchy.readthedocs.org.

#Installation

###Requirements

  • PHP 5.5.9+

Installing with Composer

  1. In your composer.json, add the dependency: "tamayo/stretchy": "2.0.0"

  2. Add the Stretchy service provider in your app.config:

        'Tamayo\Stretchy\StretchyServiceProvider'
  1. Add the following aliases:
		'Index'    => 'Tamayo\Stretchy\Facades\Index',
		'Document' => 'Tamayo\Stretchy\Facades\Document',
		'Stretchy' => 'Tamayo\Stretchy\Facades\Stretchy'
  1. (Optional) If you want to override the default configuration:
php artisan config:publish tamayo/stretchy

Located in your laravel config directory: packages/tamayo/stretchy/config.php

##Quick Examples ####Create Index To create a basic index just do the following:

Index::create('foo');

If you want to specify shards and replicas:

Index::create('foo', function($index)
	{
		$index->shards(5);
		$index->replicas(1);
	});

####Delete Index

Index::delete('foo');

####Document indexing

Document::index('foo')
    ->type('tweet')
    ->id(13) // Optional (if not specified elastic will generate an unique id)
    ->insert([
        'username' => '@ericktamayo',
        'tweet'    => 'Hello world!'
    ]);

####Update a document

Document::index('foo')
    ->type('tweet')
    ->id(13)
    ->update(['tweet' => 'Hello world!!!']);

####Get a document

Document::index('foo')->type('tweet')->Id(13)->get();

####Delete a document

Document::index('foo')->type('tweet')->Id(13)->delete();

###Searching

#####Match Query

Stretchy::search('foo')->match('bar', 'Stretchy')->get();

To provide additional parameters:

Stretchy::search('foo')
	->match('bar', 'baz', ['operator' => 'and', 'zero_terms_query' => 'all'])
	->get();

or

Stretchy::search('foo')
	->match('bar', 'Stretchy', function($match)
	{
		$match->operator('and');
		$match->zeroTermsQuery('all');
		$match->cutoffFrequency(0.001);
	})
	->get();

#####Term Query

Stretchy::search('foo')->term('bar', 'baz')->get();

To provide additional parameters:

Stretchy::search('foo')->term('bar', 'baz', ['boost' => 2])->get();

or

Stretchy::search('foo')
	->term('bar', 'baz', function($term)
	{
		$term->boost(2);
	})
	->get();

#####Bool Query

Stretchy::search('foo')
	->bool(function($query)
	{
		$query->must(function($must)
		{
			$must->match('bar', 'baz');
		});

		$query->mustNot(function($mustNot)
		{
			$mustNot->match('bar', 'qux');
		});

		$query->should(function($should)
		{
			$should->match('bar', 'bah');
		});

		$query->minimumShouldMatch(1);
	})
	->get();

More examples can be found in the documentation.

Roadmap

  • Documentation
  • Make the library to be independent from Laravel components
  • PutMapping API

###Author Erick Tamayo - ericktamayo@gmail.com - @ericktamayo

License

MIT

tamayo/stretchy 适用场景与选型建议

tamayo/stretchy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 85 次下载、GitHub Stars 达 45, 最近一次更新时间为 2015 年 01 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tamayo/stretchy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tamayo/stretchy 我们能提供哪些服务?
定制开发 / 二次开发

基于 tamayo/stretchy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 85
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 46
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 45
  • Watchers: 4
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-01-01