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_warehouse/models.py | |
parent | fa59671b441e097f8bba09f68742c403dc371b97 (diff) | |
download | Ishtar-426e963e1504fd6d80c0f34af31dfbeb95ec2ae3.tar.bz2 Ishtar-426e963e1504fd6d80c0f34af31dfbeb95ec2ae3.zip |
Search: manage localized and non localized indexation
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 6e2df520e..cec8667cd 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -32,7 +32,7 @@ from ishtar_common.models import Document, GeneralType, get_external_id, \ LightHistorizedItem, OwnPerms, Address, Person, post_save_cache, \ DashboardFormItem, ExternalIdManager, ShortMenuItem, \ document_attached_changed, SearchAltName, DynamicRequest, GeoItem, \ - QRCodeItem + QRCodeItem, SearchVectorConfig from ishtar_common.utils import cached_label_changed, post_save_geo @@ -54,8 +54,13 @@ class Warehouse(Address, GeoItem, QRCodeItem, DashboardFormItem, OwnPerms, MODEL = "warehouse" SHOW_URL = 'show-warehouse' TABLE_COLS = ['name', 'warehouse_type'] - BASE_SEARCH_VECTORS = ['name', 'warehouse_type__label', "external_id", - "town", "comment"] + BASE_SEARCH_VECTORS = [ + SearchVectorConfig("name"), + SearchVectorConfig("warehouse_type__label"), + SearchVectorConfig("external_id"), + SearchVectorConfig("town"), + SearchVectorConfig("comment", "local"), + ] EXTRA_REQUEST_KEYS = { # used by dynamic_table_documents @@ -333,10 +338,17 @@ class Container(LightHistorizedItem, QRCodeItem, GeoItem, OwnPerms): TABLE_COLS = ['reference', 'container_type__label', 'cached_location', 'cached_division', 'old_reference'] IMAGE_PREFIX = 'containers/' - BASE_SEARCH_VECTORS = ['reference', 'container_type__label', - 'cached_location', 'old_reference', 'comment'] - M2M_SEARCH_VECTORS = ['division__reference', - 'division__division__division__label'] + BASE_SEARCH_VECTORS = [ + SearchVectorConfig("reference"), + SearchVectorConfig("container_type__label"), + SearchVectorConfig("cached_location"), + SearchVectorConfig("old_reference"), + SearchVectorConfig("comment", "local"), + ] + M2M_SEARCH_VECTORS = [ + SearchVectorConfig("division__reference"), + SearchVectorConfig("division__division__division__label"), + ] # search parameters EXTRA_REQUEST_KEYS = { |