Skip to content

Commit

Permalink
Merge pull request #50 from ucldc/stage
Browse files Browse the repository at this point in the history
Deployed to Calisphere-prd, registry-prd, and registry-stg
  • Loading branch information
amywieliczka authored Jun 28, 2024
2 parents c49470d + c956592 commit 0b9209b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
23 changes: 15 additions & 8 deletions exhibits/es_cache_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def shim_record(metadata):
thumbnail_key = get_thumbnail_key(metadata)
if thumbnail_key:
metadata['reference_image_md5'] = thumbnail_key
metadata['reference_image_dimensions'] = (
metadata.get('thumbnail', {}).get('dimensions'))

media_key = get_media_key(metadata)
if media_key:
Expand Down Expand Up @@ -159,7 +161,7 @@ def es_get(item_id: str) -> Optional[ESItem]:


def es_get_ids(ids: List[str]) -> ESResults:
body = {'query': {'ids': {'values': ids}}}
body = {'query': {'ids': {'values': ids}}, 'size': len(ids)}
return es_search(body)


Expand Down Expand Up @@ -211,7 +213,8 @@ def query_encode(query_string: str = None,
if query_string:
es_query = [{
"query_string": {
"query": query_string
"query": query_string,
"analyzer": "english"
}
}]

Expand Down Expand Up @@ -274,12 +277,16 @@ def query_encode(query_string: str = None,
i = result_fields.index('type_ss')
result_fields[i] = 'type'

# if sort:
# es_params.update({
# "sort": [{
# sort[0]: {"order": sort[1]}
# }]
# })
if sort:
if sort[0] == 'score':
sort_by = '_score'
else:
sort_by = sort[0]
es_params.update({
"sort": [{
sort_by: {"order": sort[1]}
}]
})

es_params.update({'size': rows})
if start:
Expand Down
2 changes: 2 additions & 0 deletions exhibits/templates/exhibits/exhibit_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<div class="thumbnail__tile-icon fa-bar-chart"></div>
{% elif exhibitItemData.type_ss.0|lower == "image" %}
<div class="thumbnail__tile-icon fa-picture-o"></div>
{% else %}
<div class="thumbnail__tile-icon fa-file"></div>
{% endif %}
{% endif %}
{% elif item.custom_crop %}
Expand Down
2 changes: 2 additions & 0 deletions exhibits/templates/exhibits/item_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<div class="obj__tile-icon fa-file-text-o"></div>
{% elif item.type_ss.0|lower == "dataset" %}
<div class="obj__tile-icon fa-bar-chart"></div>
{% else %}
<div class="obj__tile-icon fa-file"></div>
{% endif %}
</div>
{% endif %}
Expand Down
2 changes: 2 additions & 0 deletions exhibits/templatetags/exhibit_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def clip_height(dimensions, clip):


def get_dimensions(text, delimiter):
if isinstance(text, list):
return text[0], text[1]
dimensions = [int(dimension.strip()) for dimension in text.split(delimiter)]
x = dimensions[0]
y = dimensions[1]
Expand Down

0 comments on commit 0b9209b

Please sign in to comment.