Skip to content

Commit e082337

Browse files
committed
added place of origin to data and search
1 parent c04d6d0 commit e082337

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

resources/js/search.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function searchData(params) {
4444
if (params.title && !matchesField(item, 'displayTitleEnglish', params.title)) return false;
4545
if (params.syriacText && !matchesField(item, 'syrTitle', params.syriacText)) return false;
4646
if (params.placeName && !matchesField(item, 'placeName', params.placeName)) return false;
47+
if (params.origPlace && !matchesField(item, 'origPlace', params.origPlace)) return false;
4748
if (params.persName && !matchesField(item, 'persName', params.persName)) return false;
4849
if (params.shelfmark && !matchesField(item, 'shelfmark', params.shelfmark)) return false;
4950
if (params.decorations && !matchesField(item, 'decorations', params.decorations)) return false;
@@ -136,7 +137,8 @@ async function runSearch() {
136137
persName: params.get('persName'),
137138
shelfmark: params.get('shelfmark'),
138139
decorations: params.get('decorations'),
139-
decorationsType: params.get('decorationsType')
140+
decorationsType: params.get('decorationsType'),
141+
origPlace: params.get('origPlace')
140142
};
141143

142144
const hasQuery = Object.values(searchParams).some(v => v);

search.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ <h1 style="padding-left:1em; color:white; margin-top:3em;">Advanced Search</h1>
244244
<div class="form-group">
245245
<div class="col-sm-9 col-md-10 col-sm-offset-3 col-md-offset-2">
246246
Limit search to place of origin:
247-
<input type="checkbox" id="origPlaceLimit" name="origPlaceLimit" value="true">
247+
<input type="checkbox" id="origPlace" name="origPlace" value="true">
248248
</div>
249249
</div>
250250

@@ -339,7 +339,8 @@ <h2 style="margin-bottom: 20px;">Search Results</h2>
339339
if (urlParams.get('shelfmark')) $('#shelfmark').val(urlParams.get('shelfmark'));
340340
if (urlParams.get('decorations')) $('#decorations').val(urlParams.get('decorations'));
341341
if (urlParams.get('decorationsType')) $('#decorationsType').val(urlParams.get('decorationsType'));
342-
342+
if (urlParams.get('origPlace')) $('#placeName').val(urlParams.get('origPlace'));
343+
343344
$('#toggleSearch').on('click', function() {
344345
$('#advancedSearch').slideToggle();
345346
});
@@ -360,7 +361,8 @@ <h2 style="margin-bottom: 20px;">Search Results</h2>
360361
persName: $('#persName').val(),
361362
shelfmark: $('#shelfmark').val(),
362363
decorations: $('#decorations').val(),
363-
decorationsType: $('#decorationsType').val()
364+
decorationsType: $('#decorationsType').val(),
365+
origPlace: $('#origPlace').is(':checked') ? $('#placeName').val() : ''
364366
};
365367
const params = new URLSearchParams();
366368
Object.keys(searchParams).forEach(key => {

tei2json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
# directory -> produce one JSON file per TEI named <basename>.json
1212
python tei2json.py --dir ./britishLibrary-data/data/tei --outdir json_output
13-
13+
1414
# directory -> produce OpenSearch bulk file
1515
python tei2json.py --dir ./britishLibrary-data/data/tei --bulk bulk_data.json --index britishlibrary-index-1 --idprefix ms
1616
"""
@@ -120,6 +120,7 @@ def extract_json(tree):
120120

121121
# placeName
122122
place_list = text_list(root, ".//tei:placeName")
123+
origin_place_list = text_list(root, ".//tei:origPlace")
123124

124125
# shelfmark: altIdentifier idno type=BL-Shelfmark or altIdentifier/ idno content
125126
shelfmarks = text_list(root, ".//tei:altIdentifier/tei:idno[@type='BL-Shelfmark'] | .//tei:altIdentifier/tei:idno | .//tei:msIdentifier//tei:idno[@type='BL-Shelfmark']")
@@ -189,6 +190,7 @@ def extract_json(tree):
189190
if summary: out["summary"] = summary
190191
if pers_list: out["persName"] = pers_list
191192
if place_list: out["placeName"] = place_list
193+
if origin_place_list: out["origPlace"] = origin_place_list
192194
if shelfmarks: out["shelfmark"] = shelfmarks
193195
if final_rubrics: out["finalRubrics"] = final_rubrics
194196
if colophons: out["colophons"] = colophons

0 commit comments

Comments
 (0)