From 2bc60033c79780e11a05011b5c803da83f03a8fe Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 Mar 2020 16:09:56 +0100 Subject: Full-search index: year index for treatments - town for warehouse --- archaeological_finds/models_treatments.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'archaeological_finds/models_treatments.py') diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 1f2ad1c0f..a8a06ae27 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -143,6 +143,9 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem, SearchVectorConfig("description", "local"), SearchVectorConfig("other_reference"), ] + PROPERTY_SEARCH_VECTORS = [ + SearchVectorConfig("year_index"), + ] INT_SEARCH_VECTORS = [ SearchVectorConfig("year"), SearchVectorConfig("index"), @@ -248,6 +251,10 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem, def natural_key(self): return (self.external_id, ) + @property + def year_index(self): + return "{}-{}".format(self.year, self.index) + @classmethod def get_query_owns(cls, ishtaruser): return (Q(history_creator=ishtaruser.user_ptr) | -- cgit v1.2.3