Skip to content

Instantly share code, notes, and snippets.

@javisantana
Created April 13, 2012 09:16
Show Gist options
  • Save javisantana/2375362 to your computer and use it in GitHub Desktop.
Save javisantana/2375362 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 map(lambda x: x[1], filter(lambda x: q in x[0], index))
return []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment