Skip to content

Commit

Permalink
document: add text for the partOf
Browse files Browse the repository at this point in the history
* Adds a text version of the partOf document as done in the list of results.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed Aug 29, 2023
1 parent eb4c610 commit 9fccd27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rero_ils/modules/documents/serializers/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from rero_ils.modules.serializers import JSONSerializer

from ..dumpers import document_replace_refs_dumper
from ..dumpers.indexer import IndexerDumper
from ..extensions import TitleExtension

GLOBAL_VIEW_CODE = LocalProxy(lambda: current_app.config.get(
Expand All @@ -53,6 +54,7 @@ def preprocess_record(self, pid, record, links_factory=None, **kwargs):
"""Prepare a record and persistent identifier for serialization."""
rec = record

# TODO: uses dumpers
# build responsibility data for display purpose
responsibility_statement = rec.get('responsibilityStatement', [])
if responsibilities := create_title_responsibilites(
Expand All @@ -70,8 +72,18 @@ def preprocess_record(self, pid, record, links_factory=None, **kwargs):

if variant_titles := create_title_variants(titles):
rec['ui_title_variants'] = variant_titles
return super().preprocess_record(

data = super().preprocess_record(
pid=pid, record=rec, links_factory=links_factory, kwargs=kwargs)
metadata = data['metadata']
resolve = request.args.get(
'resolve',
default=False,
type=lambda v: v.lower() in ['true', '1']
)
if request and resolve:
IndexerDumper()._process_host_document(None, metadata)
return data

def _postprocess_search_hit(self, hit: dict) -> None:
"""Post-process each hit of a search result."""
Expand Down

0 comments on commit 9fccd27

Please sign in to comment.