Code Monkey home page Code Monkey logo

redis-completion's Introduction

redis-completion

autocompletion with redis based on:

redis-completion is capable of storing a large number of phrases and quickly searching them for matches. Rich data can be stored and retrieved, helping you avoid trips to the database when retrieving search results.

check out the documentation for more info.

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

schema

http://redis-completion.readthedocs.org/en/latest/_images/schema.jpg

redis-completion's People

Contributors

coleifer avatar spahl avatar

Stargazers

Steve Zhi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.