utils¶
Functions
- intranet.apps.search.utils.get_query(query_string, search_fields)[source]¶
Returns a query, that is a combination of Q objects.
That combination aims to search keywords within a model by testing the given search fields.
- intranet.apps.search.utils.normalize_query(query_string, findterms=<built-in method findall of re.Pattern object>, normspace=<built-in method sub of re.Pattern object>)[source]¶
Splits the query string in individual keywords, getting rid of unnecessary spaces and grouping quoted words together. Example:
>>> normalize_query(' some random words "with quotes " and spaces') ['some', 'random', 'words', 'with quotes', 'and', 'spaces']