def get_query_includes(tokenized_terms, search_fields):
query = None<EOL>for term in tokenized_terms:<EOL><INDENT>or_query = None<EOL>for field_name in search_fields:<EOL><INDENT>q = Q(**{"<STR_LIT>" % field_name: term})<EOL>if or_query is None:<EOL><INDENT>or_query = q<EOL><DEDENT>else:<EOL><INDENT>or_query = or_query | q<EOL><DEDENT><DEDENT>if query is None:<EOL><INDENT>query = or_query<EOL><DEDENT>else:<EOL><INDENT>query = query & or_query<EOL><DEDENT><DEDENT>return query<EOL>
Builds a query for included terms in a text search.