# waiting for available database
python $app/wait.py
+#fix contains haystack elasticsearch
+cd /opt/miniconda/lib/python2.7/site-packages/haystack/backends && sed -i "s/'contains': u'%s'/'contains': u'*%s*'/g" elasticsearch_backend.py && cd $app
+
# django init
python $manage syncdb --noinput
python $manage migrate --noinput
python $manage collectstatic --noinput
python $manage telemeta-create-admin-user
python $manage telemeta-create-boilerplate
+python $manage rebuild_index --noinput
if [ $DEBUG = "False" ]
then
HAYSTACK_CONNECTIONS = {
'default': {
- 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
+ 'ENGINE': 'telemeta.util.backend.CustomElasticEngine',
'URL': 'http://search:9200/',
'INDEX_NAME': 'haystack',
'INLUDE_SPELLING': True,
from datetime import date
from django.utils.translation import ugettext_lazy as _
-
class HaySearchForm(FacetedSearchForm):
q = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'form-control', 'type' : 'text'}))
--- /dev/null
+from haystack.backends.elasticsearch_backend import *
+
+class CustomElasticBackend(ElasticsearchSearchBackend):
+
+ def setup(self):
+ FIELD_MAPPINGS.get('edge_ngram')['search_analyzer']="standard";
+ FIELD_MAPPINGS.get('ngram')['search_analyzer']="standard";
+ eb = super(CustomElasticBackend, self)
+ eb.DEFAULT_SETTINGS.get('settings').get('analysis').get('filter').get('haystack_ngram')['max_gram']=30
+ eb.setup()
+
+class CustomElasticEngine(ElasticsearchSearchEngine):
+ backend = CustomElasticBackend
\ No newline at end of file