Project

stupa

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby client library for Stupa
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 0.8
~> 2.11
~> 2.1

Runtime

~> 0.5.3
 Project Readme

Stupa client library for Ruby

A Ruby client for Stupa.

"Stupa is an associative search engine. You can search related documents with high performance and high precision. Since document data and inverted indexes are kept in memory, Stupa reflects updates of documents in search results in real time."

The current SVN code of Stupa contains a fast HTTP API built on libevent. This is what this library connects to.

Usage

require 'stupa'

client = Stupa::Client.new(host: "localhost", port: 22122)

# delete all entries
client.clear

# get the number of entries in the database
size = client.size

# record a couple key/features tuples
client.add('key1' => 'feat1')
client.add('key2' => 'feat2', 'key3' => 'feat3')
client.add('key4' => ['feat4', 'feat5', 'feat6'])

# delete keys
client.delete('key3')
client.delete(['key1', 'key2'])

# dump the database
client.save('/var/db/stupa.db')

# load from a dump
client.load('/var/db/stupa.db')

# look for entries similar to key1
results = client.dsearch(query: 'key1')
results = client.dsearch(query: 'key1', max: 50)

# look for keys with matching features
results = client.fsearch(query: 'feat1')
results = client.fsearch(query: ['feat2', 'feat3'])
results = client.fsearch(query: ['feat2', 'feat3'], max: 50)

Copyright

See LICENSE for details.