Skip to content

Commit

Permalink
EREGCSC-2771 -- Updating front end field/display mappings (#1378)
Browse files Browse the repository at this point in the history
* chore: udpate gitignore to ignore db backups

* feat: add internal link post save method

* feat: update front end to show docID for internal items

* feat: further refinement of internal doc field/display mappings
  • Loading branch information
PhilR8 authored Jul 25, 2024
1 parent 1f084ce commit 2d08ab2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
17 changes: 14 additions & 3 deletions solution/backend/content_search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ def get_or_create_index(instance, created):

@receiver(post_save, sender=PublicLink)
@receiver(post_save, sender=FederalRegisterLink)
@receiver(post_save, sender=InternalLink)
def update_indexed_resource(sender, instance, created, **kwargs):
def update_indexed_public_resource(sender, instance, created, **kwargs):
index = get_or_create_index(instance, created)
index.name = instance.document_id
index.summary = instance.title
Expand All @@ -140,7 +139,7 @@ def update_indexed_resource(sender, instance, created, **kwargs):


@receiver(post_save, sender=InternalFile)
def update_indexed_file(sender, instance, created, **kwargs):
def update_indexed_internal_file(sender, instance, created, **kwargs):
index = get_or_create_index(instance, created)
index.name = instance.title
index.summary = instance.summary
Expand All @@ -154,6 +153,18 @@ def update_indexed_file(sender, instance, created, **kwargs):
index.save()


@receiver(post_save, sender=InternalLink)
def update_indexed_internal_link(sender, instance, created, **kwargs):
index = get_or_create_index(instance, created)
index.name = instance.title
index.summary = instance.summary
index.rank_a_string = instance.title
index.rank_b_string = instance.summary
index.rank_c_string = instance.date
index.rank_d_string = " ".join([str(i) for i in instance.subjects.all()])
index.save()


@receiver(post_save, sender=Part)
def update_indexed_part(sender, instance, created, **kwargs):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ const showResultSnippet = (item) => {
if (
DOCUMENT_TYPES_MAP[getFieldVal({ item, fieldName: "type" })] ===
"Internal" &&
(item.content_headline || item.summary_headline || item.summary_string)
(item.content_headline ||
item.summary_headline ||
item.summary_string ||
item.summary)
)
return true;
Expand Down Expand Up @@ -101,6 +104,8 @@ const getResultSnippet = (item) => {
snippet = addSurroundingEllipses(item.summary_headline);
} else if (item.summary_string) {
snippet = item.summary_string;
} else if (item.summary) {
snippet = item.summary;
}
return snippet;
Expand Down Expand Up @@ -183,7 +188,6 @@ const getUrl = ({ type: resourceType, url, uid }) =>
: url;
const needsBar = (item) =>
DOCUMENT_TYPES_MAP[getFieldVal({ item, fieldName: "type" })] === "Public" &&
getFieldVal({ item, fieldName: "date" }) &&
getFieldVal({ item, fieldName: "document_id" });
Expand Down Expand Up @@ -358,12 +362,7 @@ const currentPageResultsRange = getCurrentPageResultsRange({
:division="doc.division"
/-->
<span
v-if="
DOCUMENT_TYPES_MAP[
getFieldVal({ item: doc, fieldName: 'type' })
] === 'Public' &&
getFieldVal({ item: doc, fieldName: 'document_id' })
"
v-if="getFieldVal({ item: doc, fieldName: 'document_id' })"
>{{
getFieldVal({ item: doc, fieldName: "document_id" })
}}</span
Expand Down

0 comments on commit 2d08ab2

Please sign in to comment.