From 4c4dfac806bd01450e39600ffd8b4551792632b5 Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Thu, 23 Nov 2017 18:52:50 +0100 Subject: [PATCH] Removes keyword_split. --- wagtail/contrib/postgres_search/utils.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/wagtail/contrib/postgres_search/utils.py b/wagtail/contrib/postgres_search/utils.py index f3f42f97ac..0e3e259605 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.