Skip to content

Instantly share code, notes, and snippets.

@jorgebastida
Forked from javisantana/search.py
Created April 13, 2012 09:44
Show Gist options
  • Save jorgebastida/2375464 to your computer and use it in GitHub Desktop.
Save jorgebastida/2375464 to your computer and use it in GitHub Desktop.
search like a real hacker
#index is like this
index = [
('content indexed', object_id),
('test string', 1),
...
]
def _search(q):
if q:
q = q.lower()
return [x[1] for x in index if q in x[0]]
return []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment