code: def advanced_search(pattern):
      
      query_parsed = QUERY.parseString(pattern)
      return Entry.published.filter(query_parsed[0]).distinct()
docs: Parse the grammar of a pattern and build a queryset with it.