Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Provide new way of determining if search is enabled

Jakub Draganek3a74ba7f6644
diff --git a/saleor/core/context_processors.py b/saleor/core/context_processors.py
index b8a1c5fd4c..ece1339492 100644
--- a/saleor/core/context_processors.py
+++ b/saleor/core/context_processors.py
@@ -31,7 +31,7 @@ def categories(request):
def search_enabled(request):
- return {'SEARCH_IS_ENABLED': bool(settings.SEARCH_BACKENDS)}
+ return {'SEARCH_IS_ENABLED': bool(settings.ENABLE_SEARCH)}
def webpage_schema(request):
@@ -43,7 +43,7 @@ def webpage_schema(request):
'url': url,
'name': site.name,
'description': site.settings.description}
- if bool(settings.SEARCH_BACKENDS):
+ if bool(settings.ENABLE_SEARCH):
data['potentialAction'] = {
'@type': 'SearchAction',
'target': '%s%s?q={search_term}' % (url, reverse('search:search')),
diff --git a/saleor/settings.py b/saleor/settings.py
index 564da97aae..66218098c5 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -351,9 +351,11 @@ WEBPACK_LOADER = {
LOGOUT_ON_PASSWORD_CHANGE = False
+ENABLE_SEARCH = False
ELASTICSEARCH_URL = os.environ.get('ELASTICSEARCH_URL')
if ELASTICSEARCH_URL:
+ ENABLE_SEARCH = True
INSTALLED_APPS.append('django_elasticsearch_dsl')
ELASTICSEARCH_DSL = {
'default': {
@@ -361,8 +363,6 @@ if ELASTICSEARCH_URL:
},
}
-SEARCH_BACKENDS = {}
-
GRAPHENE = {
'MIDDLEWARE': [