Skip to content

Instantly share code, notes, and snippets.

@toastdriven
Created November 18, 2011 17:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toastdriven/1377121 to your computer and use it in GitHub Desktop.
Save toastdriven/1377121 to your computer and use it in GitHub Desktop.
import operator
from haystack.query import SearchQuerySet, SQ
stuff = ['foo', 'bar', 'baz']
the_filters = reduce(operator.or_, [SQ(tag=tag_name) for tag_name in stuff])
sqs = SearchQuerySet().filter(the_filters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment