Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ietf/utils/searchindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _sanitize_text(content):
def typesense_doc_from_rfc(rfc: Document) -> DocumentSchema:
assert rfc.type_id == "rfc"
assert rfc.rfc_number is not None
assert rfc.pages is not None

keywords: list[str] = rfc.keywords # help type checking

Expand Down Expand Up @@ -119,6 +120,7 @@ def typesense_doc_from_rfc(rfc: Document) -> DocumentSchema:
"filename": rfc.name,
"title": rfc.title,
"abstract": _sanitize_text(rfc.abstract),
"pages": rfc.pages,
"keywords": keywords,
"type": "rfc",
"state": [state.name for state in rfc.states.all()],
Expand Down Expand Up @@ -231,6 +233,8 @@ def update_or_create_rfc_entries(
{"name": "title", "type": "string", "facet": False},
# Abstract of the draft / rfc
{"name": "abstract", "type": "string", "facet": False},
# Number of pages
{"name": "pages", "type": "int32", "facet": False},
# A list of search keywords if relevant, set to empty array otherwise
{"name": "keywords", "type": "string[]", "facet": True},
# Type of the document
Expand Down
1 change: 1 addition & 0 deletions ietf/utils/tests_searchindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def test_typesense_doc_from_rfc(self):
self.assertEqual(result["id"], f"doc-{rfc.pk}")
self.assertEqual(result["rfcNumber"], rfc.rfc_number)
self.assertEqual(result["abstract"], searchindex._sanitize_text(rfc.abstract))
self.assertEqual(result["pages"], rfc.pages)
self.assertNotIn("adName", result)
self.assertNotIn("content", result) # no blob
self.assertNotIn("subseries", result)
Expand Down
Loading