0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

deprecation/1.4: Removed Page.search

This commit is contained in:
Karl Hobley 2015-12-20 13:04:45 +00:00
parent 94eb91c2fe
commit 848ded8569

View File

@ -41,9 +41,8 @@ from wagtail.wagtailcore.url_routing import RouteResult
from wagtail.wagtailcore.signals import page_published, page_unpublished
from wagtail.wagtailsearch import index
from wagtail.wagtailsearch.backends import get_search_backend
from wagtail.utils.deprecation import RemovedInWagtail14Warning, RemovedInWagtail15Warning
from wagtail.utils.deprecation import RemovedInWagtail15Warning
logger = logging.getLogger('wagtail.core')
@ -726,40 +725,6 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed
except self.specific_class.DoesNotExist:
return None
@classmethod
def search(
cls,
query_string,
show_unpublished=False,
search_title_only=False,
extra_filters={},
prefetch_related=[],
path=None
):
# This is deprecated use Page.objects.search() instead
warnings.warn(
"The Page.search() method is deprecated. "
"Please use the Page.objects.search() method instead.",
RemovedInWagtail14Warning, stacklevel=2)
# Filters
filters = extra_filters.copy()
if not show_unpublished:
filters['live'] = True
# Path
if path:
filters['path__startswith'] = path
# Fields
fields = None
if search_title_only:
fields = ['title']
# Search
s = get_search_backend()
return s.search(query_string, cls, fields=fields, filters=filters, prefetch_related=prefetch_related)
@classmethod
def clean_subpage_models(cls):
"""