diff --git a/wagtail/contrib/postgres_search/utils.py b/wagtail/contrib/postgres_search/utils.py index f3f42f97a..0e3e25960 100644 --- a/wagtail/contrib/postgres_search/utils.py +++ b/wagtail/contrib/postgres_search/utils.py @@ -1,7 +1,6 @@ from __future__ import absolute_import, division, unicode_literals import operator -import re from functools import partial, reduce from itertools import zip_longest @@ -31,25 +30,6 @@ AND = partial(reduce, operator.and_) ADD = partial(reduce, operator.add) -def keyword_split(keywords): - """ - Return all the keywords in a keyword string. - - Keeps keywords surrounded by quotes together, removing the surrounding quotes: - - >>> keyword_split('Hello I\\'m looking for "something special"') - ['Hello', "I'm", 'looking', 'for', 'something special'] - - Nested quoted strings are returned as is: - - >>> keyword_split("He said \\"I'm looking for 'something special'\\" so I've given him the 'special item'") - ['He', 'said', "I'm looking for 'something special'", 'so', "I've", 'given', 'him', 'the', 'special item'] - - """ - matches = re.findall(r'"([^"]+)"|\'([^\']+)\'|(\S+)', keywords) - return [match[0] or match[1] or match[2] for match in matches] - - def get_descendant_models(model): """ Returns all descendants of a model, including the model itself.