From 6daa6173568c7385044c318f8f1c243b5bd18b2f Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Thu, 11 May 2017 17:57:23 -0300 Subject: [PATCH] Usa Whoosh por default, ou solr se especificado no .env --- sapl/settings.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sapl/settings.py b/sapl/settings.py index f6814440f..5cd22437e 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -84,13 +84,22 @@ INSTALLED_APPS = ( ) + SAPL_APPS +# FTS = Full Text Search +SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine' +SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh')) + +SOLR_URL = config('SOLR_URL', cast=str, default='') +if SOLR_URL: + SEARCH_BACKEND = 'haystack.backends.solr_backend.SolrEngine' + SEARCH_URL = ('URL', config('SOLR_URL', cast=str)) + # ...or for multicore... + # 'URL': 'http://127.0.0.1:8983/solr/mysite', + HAYSTACK_CONNECTIONS = { 'default': { - 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', - 'URL': config('SOLR_URL', cast=str) - # ...or for multicore... - # 'URL': 'http://127.0.0.1:8983/solr/mysite', + 'ENGINE': SEARCH_BACKEND, + SEARCH_URL[0] : SEARCH_URL[1] }, }