redis-completion 0.4.0

Autocomplete with redis
redis-completion is a package that provides autocompletion with redis based on:

- http://antirez.com/post/autocomplete-with-redis.html
- http://stackoverflow.com/questions/1958005/redis-autocomplete/1966188

Usage

If you just want to store really simple things, like strings:

engine = RedisEngine()
titles = ['python programming', 'programming c', 'unit testing python',
 'testing software', 'software design']
map(engine.store, titles)

>>> engine.search('pyt')
['python programming', 'unit testing python']

>>> engine.search('test')
['testing software', 'unit testing python']


If you want to store more complex data, like blog entries:

Entry.create(title='an entry about python', published=True)
Entry.create(title='all about redis', published=True)
Entry.create(title='using redis with python', published=False)

for entry in Entry.select():
 engine.store_json(entry.id, entry.title, {
 'published': entry.published,
 'title': entry.title,
 'url': entry.get_absolute_url(),
 })

>>> engine.search_json('pytho')
[{'published': True, 'title': 'an entry about python', 'url': '/blog/1/'},
 {'published': False, 'title': 'using redis with python', 'url': '/blog/3/'}]

# just published entries, please
>>> engine.search_json('redis', filters=[lambda i: i['published'] == True])
[{u'published': True, u'title': u'all about redis', u'url': u'/blog/2/'}]


Installing

Install with pip:

pip install redis-completion

Install via git:

git clone https://github.com/coleifer/redis-completion.git
cd redis-completion
python setup.py install

last updated on:
September 19th, 2012, 16:56 GMT
price:
FREE!
homepage:
github.com
license type:
MIT/X Consortium License 
developed by:
Charles Leifer
category:
ROOT \ Internet \ HTTP (WWW)
redis-completion
Download Button

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT