def get_text_query(query_string, search_fields):
include_terms, exclude_terms = get_text_tokenizer(query_string)<EOL>include_q = get_query_includes(include_terms, search_fields)<EOL>exclude_q = get_query_excludes(exclude_terms, search_fields)<EOL>query = None<EOL>if include_q and exclude_q:<EOL><INDENT>query = include_q & ~exclude_q<EOL><DEDENT>elif not exclude_q:<EOL><INDENT>query = include_q<EOL><DEDENT>else:<EOL><INDENT>query = ~exclude_q<EOL><DEDENT>return query<EOL>
Builds a query for both included & excluded terms in a text search.