def fulltext_project_search_filter(string):
    from haystack.query import SQ
    if string:
        filters = []
        for w in string.split():
            filters.append(SQ(slug='%s^1.2' % w))
            filters.append(SQ(name='%s^1.2' % w))
            filters.append(SQ(description='%s^1.1' % w))
            filters.append(SQ(text='%s~' % w))
        return reduce(operator.__or__, filters)
    else:
        return SQ(text='')
Take a string and return a filter to be used on the SearchQuerySet.
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/txcommon/haystack_utils.py/fulltext_project_search_filter