-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #333 from datosgobar/331-analyze-search
Reorganizo el índice de metadatos
- Loading branch information
Showing
6 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,6 @@ | |
'dataset_source': 'dataset_source_keyword', | ||
'catalog_id': 'catalog_id', | ||
} | ||
|
||
|
||
ANALYZER = 'spanish_asciifold' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#! coding: utf-8 | ||
from elasticsearch_dsl import Index, analyzer | ||
|
||
from series_tiempo_ar_api.apps.metadata import constants | ||
from series_tiempo_ar_api.libs.indexing.elastic import ElasticInstance | ||
|
||
|
||
def add_analyzer(index: Index): | ||
"""Agrega un nuevo analyzer al índice, disponible para ser usado | ||
en todos sus fields. El analyzer aplica lower case + ascii fold: | ||
quita acentos y uso de ñ, entre otros, para permitir búsqueda de | ||
texto en español | ||
""" | ||
index.analyzer( | ||
analyzer(constants.ANALYZER, | ||
tokenizer='standard', | ||
filter=['lowercase', 'asciifolding']) | ||
) | ||
|
||
|
||
def get_fields_meta_index(): | ||
fields_meta = Index(constants.FIELDS_INDEX, using=ElasticInstance.get()) | ||
|
||
add_analyzer(fields_meta) | ||
return fields_meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters