From 0a8f3c5f4341f8b581c074faded56e570f250e5b Mon Sep 17 00:00:00 2001 From: Fatima Gomez Date: Tue, 1 Jun 2021 14:18:22 -0500 Subject: [PATCH 01/11] make Date facet singular --- lametro/management/commands/refresh_guid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lametro/management/commands/refresh_guid.py b/lametro/management/commands/refresh_guid.py index 1c73632d8..82ad17e96 100644 --- a/lametro/management/commands/refresh_guid.py +++ b/lametro/management/commands/refresh_guid.py @@ -68,7 +68,7 @@ class ClassificationMixin: 'Subregion', ), 'significant_date_exact': ( - 'Dates', + 'Date', ), 'motion_by_exact': ( 'Board Member', From b3a8222a138fcdc4fbd211322d7aa0bd79e2ee4f Mon Sep 17 00:00:00 2001 From: Fatima Gomez Date: Tue, 1 Jun 2021 17:32:37 -0500 Subject: [PATCH 02/11] add new fiscal_year facet based on plan_program_policy facet --- lametro/management/commands/refresh_guid.py | 3 +++ lametro/models.py | 3 ++- lametro/search_indexes.py | 4 ++++ lametro/views.py | 1 + solr_configs/conf/schema.xml | 2 ++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lametro/management/commands/refresh_guid.py b/lametro/management/commands/refresh_guid.py index 82ad17e96..4371115fe 100644 --- a/lametro/management/commands/refresh_guid.py +++ b/lametro/management/commands/refresh_guid.py @@ -78,6 +78,9 @@ class ClassificationMixin: 'Program', 'Policy' ), + 'fiscal_year_exact': ( + '' + ) } @property diff --git a/lametro/models.py b/lametro/models.py index 662c4edb5..2362faa78 100644 --- a/lametro/models.py +++ b/lametro/models.py @@ -911,7 +911,8 @@ class LAMetroSubject(models.Model): ('significant_date_exact', 'Significant Date'), ('motion_by_exact', 'Motion By'), ('topics_exact', 'Subject'), - ('plan_program_policy_exact', 'Plan, Program, or Policy') + ('plan_program_policy_exact', 'Plan, Program, or Policy'), + ('fiscal_year_exact', 'Fiscal Year') ] class Meta: diff --git a/lametro/search_indexes.py b/lametro/search_indexes.py index 99a2ae763..257b86a23 100644 --- a/lametro/search_indexes.py +++ b/lametro/search_indexes.py @@ -21,6 +21,7 @@ class LAMetroBillIndex(BillIndex, indexes.Indexable): significant_date = indexes.MultiValueField(faceted=True) motion_by = indexes.MultiValueField(faceted=True) plan_program_policy = indexes.MultiValueField(faceted=True) + fiscal_year = indexes.MultiValueField(faceted=True) def get_model(self): return LAMetroBill @@ -88,6 +89,9 @@ def prepare_motion_by(self, obj): def prepare_plan_program_policy(self, obj): return self._topics_from_classification(obj, 'plan_program_policy_exact') + def prepare_fiscal_year(self, obj): + return self._topics_from_classification(obj, 'fiscal_year_exact') + def _topics_from_classification(self, obj, classification): ''' Retrieve a list of topics with the given classification. diff --git a/lametro/views.py b/lametro/views.py index 4d70acbea..8e101d1af 100644 --- a/lametro/views.py +++ b/lametro/views.py @@ -734,6 +734,7 @@ def build_form(self, form_kwargs={}): .facet('motion_by')\ .facet('significant_date')\ .facet('plan_program_policy')\ + .facet('fiscal_year')\ .highlight(**{'hl.fl': 'text,attachment_text'}) data = None diff --git a/solr_configs/conf/schema.xml b/solr_configs/conf/schema.xml index e0285a8db..3e8607ef2 100644 --- a/solr_configs/conf/schema.xml +++ b/solr_configs/conf/schema.xml @@ -170,6 +170,8 @@ + +