diff --git a/geniza/corpus/forms.py b/geniza/corpus/forms.py
index 11bd56d7f..f29528a21 100644
--- a/geniza/corpus/forms.py
+++ b/geniza/corpus/forms.py
@@ -216,6 +216,13 @@ class DocumentSearchForm(RangeForm):
),
)
+ exclude_inferred = forms.BooleanField(
+ # Translators: label for "exclude inferred dates" search form filter
+ label=_("Exclude inferred dates"),
+ required=False,
+ widget=forms.CheckboxInput,
+ )
+
doctype = FacetChoiceField(
# Translators: label for document type search form filter
label=_("Document type"),
diff --git a/geniza/corpus/models.py b/geniza/corpus/models.py
index 940bb93f9..93a8551db 100644
--- a/geniza/corpus/models.py
+++ b/geniza/corpus/models.py
@@ -1220,6 +1220,10 @@ def index_data(self):
),
# combined original/standard document date for display
"document_date_t": strip_tags(self.document_date) or None,
+ # inferred document date for display
+ "document_dating_t": standard_date_display(
+ "/".join([d.isoformat() for d in self.dating_range() if d])
+ ),
# date range for filtering
"document_date_dr": self.solr_date_range(),
# date range for filtering, but including inferred datings if any exist
@@ -1232,6 +1236,17 @@ def index_data(self):
"end_date_i": (
self.end_date.numeric_format(mode="max") if self.end_date else None
),
+ # start/end of document date or date range, including inferred datings, for sort
+ "start_dating_i": (
+ self.dating_range()[0].numeric_format()
+ if self.dating_range()[0]
+ else None
+ ),
+ "end_dating_i": (
+ self.dating_range()[1].numeric_format(mode="max")
+ if self.dating_range()[1]
+ else None
+ ),
# library/collection possibly redundant?
"collection_ss": [str(f.collection) for f in fragments],
"tags_ss_lower": [t.name for t in self.tags.all()],
diff --git a/geniza/corpus/solr_queryset.py b/geniza/corpus/solr_queryset.py
index 134e2ba93..79a80f3ac 100644
--- a/geniza/corpus/solr_queryset.py
+++ b/geniza/corpus/solr_queryset.py
@@ -48,6 +48,7 @@ class DocumentSolrQuerySet(AliasedSolrQuerySet):
"shelfmark": "shelfmark_s", # string version for display
"shelfmarks": "fragment_shelfmark_ss",
"document_date": "document_date_t", # text version for search & display
+ "document_dating": "document_dating_t", # inferred date for display
"original_date_t": "original_date",
"collection": "collection_ss",
"tags": "tags_ss_lower",
diff --git a/geniza/corpus/templates/corpus/document_list.html b/geniza/corpus/templates/corpus/document_list.html
index ccee49427..a973a68c1 100644
--- a/geniza/corpus/templates/corpus/document_list.html
+++ b/geniza/corpus/templates/corpus/document_list.html
@@ -56,6 +56,11 @@
{{ page_title }}
{# NOTE: stimulus action is configured via django widget attrs #}
{{ form.docdate }}
+