Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created May 14, 2013 19:35
Show Gist options
  • Save groovecoder/5578799 to your computer and use it in GitHub Desktop.
Save groovecoder/5578799 to your computer and use it in GitHub Desktop.
if search_query:
results = (results.query(or_={'title': search_query,
'content': search_query})
.highlight('content'))
result_count = results.count()
results = results[start:end]
for doc in results:
for match in doc._highlight['content']:
match = bleach.clean(match, tags=['em',], strip=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment