# If this is True, all tasks will be executed locally by blocking until the task returns.
CELERY_ALWAYS_EAGER=False
-REINDEX=False
+REINDEX=True
return self.no_query_found()
if self.cleaned_data.get('q'):
- sqs = sqs.filter(title__contains=self.cleaned_data['q'])
+ sqs = sqs.filter(title__startswith=self.cleaned_data['q'])
if self.cleaned_data.get('code'):
sqs = sqs.filter(code__contains=self.cleaned_data['code'])
if self.cleaned_data.get('location'):
- sqs = sqs.filter(location_principal__contains=self.cleaned_data['location']).filter_or(location_relation__contains=self.cleaned_data['location'])
+ sqs = sqs.filter(location_principal__startswith=self.cleaned_data['location']).filter_or(location_relation__startswith=self.cleaned_data['location'])
if self.cleaned_data['ethnic_group']:
if self.cleaned_data.get('ethnic_group') != '':
class CustomElasticBackend(ElasticsearchSearchBackend):
def setup(self):
-
- DEFAULT_FIELD_MAPPING['analyzer']='space_lower_analyzer'
+ DEFAULT_FIELD_MAPPING['analyzer']='snowball_asciifolding_analyzer'
eb = super(CustomElasticBackend, self)
- eb.DEFAULT_SETTINGS.get('settings').get('analysis').get('analyzer')['space_lower_analyzer']=\
- {"type": "custom", "tokenizer": "whitespace", "filter": ["lowercase", "asciifolding"]}
+ eb.DEFAULT_SETTINGS.get('settings').get('analysis').get('analyzer')['snowball_asciifolding_analyzer']=\
+ {"type": "custom", "tokenizer": "letter", "filter": ["lowercase", "stop", "asciifolding"]}
eb.setup()
class CustomElasticEngine(ElasticsearchSearchEngine):
backend = CustomElasticBackend
- query = CustomElasticSearchQuery#
+ query = CustomElasticSearchQuery
suggestions = [result.code for result in sqs]
elif request.GET.get('attr', '') == "collectors":
- sqs = sqs.filter(collectors__contains=request.GET.get('q', ''))[:10]
+ sqs = sqs.filter(collectors__startswith=request.GET.get('q', ''))[:10]
suggestions = [result.collectors for result in sqs]
else:
suggestions = []
-class Erreur(Exception):
- pass
\ No newline at end of file
+class Erreur(Exception):#
+ pass#
\ No newline at end of file