diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-03-20 17:26:31 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:41:37 +0200 |
commit | 426e963e1504fd6d80c0f34af31dfbeb95ec2ae3 (patch) | |
tree | 4b6301374d3f3e57102e9ef267ba9643864fea53 /archaeological_finds/models_treatments.py | |
parent | fa59671b441e097f8bba09f68742c403dc371b97 (diff) | |
download | Ishtar-426e963e1504fd6d80c0f34af31dfbeb95ec2ae3.tar.bz2 Ishtar-426e963e1504fd6d80c0f34af31dfbeb95ec2ae3.zip |
Search: manage localized and non localized indexation
Diffstat (limited to 'archaeological_finds/models_treatments.py')
-rw-r--r-- | archaeological_finds/models_treatments.py | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index e2882df35..3fc1a5afa 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -37,7 +37,7 @@ from ishtar_common.models import Document, GeneralType, \ ImageModel, BaseHistorizedItem, OwnPerms, HistoricalRecords, Person, \ Organization, ValueGetter, post_save_cache, ShortMenuItem, \ DashboardFormItem, ExternalIdManager, document_attached_changed, \ - HistoryModel, SearchAltName + HistoryModel, SearchAltName, SearchVectorConfig from ishtar_common.utils import cached_label_changed, get_current_year, \ update_data, m2m_historization_changed @@ -123,11 +123,23 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, ] BASE_SEARCH_VECTORS = [ - 'treatment_types__label', 'treatment_state__label', 'label', 'goal', - 'external_id', 'comment', 'description', 'other_reference', + SearchVectorConfig("treatment_types__label"), + SearchVectorConfig("treatment_state__label"), + SearchVectorConfig("label"), + SearchVectorConfig("goal", "local"), + SearchVectorConfig("external_id"), + SearchVectorConfig("comment", "local"), + SearchVectorConfig("description", "local"), + SearchVectorConfig("other_reference"), + ] + INT_SEARCH_VECTORS = [ + SearchVectorConfig("year"), + SearchVectorConfig("index"), + ] + M2M_SEARCH_VECTORS = [ + SearchVectorConfig("downstream__cached_label"), + SearchVectorConfig("upstream__cached_label"), ] - INT_SEARCH_VECTORS = ["year", "index"] - M2M_SEARCH_VECTORS = ['downstream__cached_label', 'upstream__cached_label'] PARENT_SEARCH_VECTORS = ['person', 'organization'] objects = ExternalIdManager() @@ -863,9 +875,15 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem, SHOW_URL = 'show-treatmentfile' TABLE_COLS = ['type', 'year', 'index', 'internal_reference', 'name'] BASE_SEARCH_VECTORS = [ - 'type__label', 'internal_reference', 'name', 'comment' + SearchVectorConfig("type__label"), + SearchVectorConfig("internal_reference"), + SearchVectorConfig("name"), + SearchVectorConfig("comment", "local"), + ] + INT_SEARCH_VECTORS = [ + SearchVectorConfig("year"), + SearchVectorConfig("index"), ] - INT_SEARCH_VECTORS = ['year', 'index'] PARENT_SEARCH_VECTORS = ['in_charge', 'applicant', 'applicant_organisation'] EXTRA_REQUEST_KEYS = { |