Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Ruby client for Sonic search backend

NotificationsYou must be signed in to change notification settings

atipugin/sonic-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gem VersionBuild StatusMaintainability

A Ruby client forSonic search backend.

Installation

Add following line to your Gemfile:

gem'sonic-ruby'

And then execute:

$ bundle

Or install it system-wide:

$ gem install sonic-ruby

Usage

Start with creating new client:

client=Sonic::Client.new('localhost',1491,'SecretPassword')

Now you can use#channel method in order to connect to specific channels:

control=client.channel(:control)ingest=client.channel(:ingest)search=client.channel(:search)

Learn more about Sonic Channels.

Indexing

# Init `ingest` channelingest=client.channel(:ingest)# Add data to indexingest.push('users','all',1,'Alexander Tipugin')# => true# Remove data from indexingest.pop('users','all',1,'Alexander Tipugin')# => 2# Count collection/bucket/object itemsingest.count('users','all',1)# => 1# Flush entire collectioningest.flushc('users')# => 1# Flush entire bucket inside collectioningest.flushb('users','all')# => 1# Flush specific object inside bucketingest.flusho('users','all',1)# => 2

Searching

# Init `search` channelsearch=client.channel(:search)# Find indexed object by termsearch.query('users','all','tipugin')# => 1# Auto-complete wordsearch.suggest('users','all','alex')# => alexander

TODO

  • Take into account maximum buffer size.
  • Consider using connection pool.
  • Return more meaningful responses from commands (i.e. booltrue instead of stringOK, int1 instead of stringRESULT 1 etc).

About

Ruby client for Sonic search backend

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp