Skip to content

Commit

Permalink
reindex, show "active" facet if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mnyrop committed May 10, 2024
1 parent a74e478 commit 27d6b85
Show file tree
Hide file tree
Showing 8 changed files with 210 additions and 203 deletions.
216 changes: 109 additions & 107 deletions lib/data/items-metadata.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/items-csv-to-json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inpath = "./lib/data/items-metadata.csv"
outpath = "./site/_data/items.json"
keys_dropable = ["Checked", "Status", "Identifier"]
keys_dropable = ["Checked", "Status", "Identifier", "Personal Name Verbose"]
keys_repeatable = [
"Alternate Title",
"Corporate Name",
Expand Down
42 changes: 21 additions & 21 deletions site/_data/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"University of California, Berkeley. Chicano Studies Library"
],
"Personal Name": [
"Arce, José Antonio, 1948-2018"
"Arce, José Antonio"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -244,7 +244,7 @@
"University of California, Berkeley. Chicano Studies Library"
],
"Personal Name": [
"Gonzalez, Lila, 1929-2013",
"Gonzalez, Lila",
"Armada, Dolores"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -593,7 +593,7 @@
"ID": "CSL00017",
"Label": "Letters to and from Alexandr Vaschenko, 1997 and 1998",
"Personal Name": [
"Vashchenko, A. (Aleksandr)",
"Vashchenko, Aleksandr",
"Castillo-Speed, Lillian"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -665,7 +665,7 @@
"University of California, Berkeley. Chicano Studies Library"
],
"Personal Name": [
"Arce, José Antonio, 1948-2018"
"Arce, José Antonio"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -702,7 +702,7 @@
"University of California, Berkeley. Chicano Studies Library"
],
"Personal Name": [
"Galarza, Ernesto, 1905-1984"
"Galarza, Ernesto"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -1273,7 +1273,7 @@
],
"Personal Name": [
"Chabrán, Richard",
"García-Ayvens, Francisco, 1948-2018",
"García-Ayvens, Francisco",
"Castillo-Speed, Lillian"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -1542,7 +1542,7 @@
"Personal Name": [
"Oropeza, Annette",
"Soto, Carolyn",
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -1812,7 +1812,7 @@
],
"Personal Name": [
"Pratt, Virginia",
"García-Ayvens, Francisco, 1948-2018",
"García-Ayvens, Francisco",
"Chabrán, Richard"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -1920,7 +1920,7 @@
"Yañez, Elva",
"Castro, Rafaela",
"Treviño, Oscar",
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Santa Barbara, California"
Expand Down Expand Up @@ -1998,7 +1998,7 @@
"University of California, Berkeley. Chicano Studies Library"
],
"Personal Name": [
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -2073,7 +2073,7 @@
"Vort Corporation"
],
"Personal Name": [
"Holt, T. D. (Thomas D.)",
"Holt, Thomas D.",
"Chabrán, Richard"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -2154,7 +2154,7 @@
"University of Michigan. School of Social Work"
],
"Personal Name": [
"Radin, Norma, 1926-1998",
"Radin, Norma",
"Chabrán, Richard"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -2187,7 +2187,7 @@
"Excélsior (Mexico City, Mexico)"
],
"Personal Name": [
"Fernández Ponte, Fausto, 1936-2010",
"Fernández Ponte, Fausto",
"Chabrán, Richard"
],
"Place of Publication or Production": [
Expand Down Expand Up @@ -2223,7 +2223,7 @@
],
"Personal Name": [
"Trujillo, Larry",
"Manza, August G., 1931-2022"
"Manza, August G."
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -2294,7 +2294,7 @@
],
"Personal Name": [
"Trujillo, Larry",
"Manza, August G., 1931-2022"
"Manza, August G."
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -2607,7 +2607,7 @@
"Bibliopolítica"
],
"Personal Name": [
"García-Ayvens, Francisco, 1948-2018",
"García-Ayvens, Francisco",
"Chabrán, Richard",
"Montoya, Malaquías"
],
Expand Down Expand Up @@ -2654,7 +2654,7 @@
"Biblio-Política"
],
"Personal Name": [
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Berkeley, California"
Expand Down Expand Up @@ -2982,7 +2982,7 @@
"Personal Name": [
"Boyd, Barbara Gray",
"Elmore, Faye",
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Hayward, California"
Expand Down Expand Up @@ -3071,7 +3071,7 @@
],
"Personal Name": [
"Danky, James Philip",
"García-Ayvens, Francisco, 1948-2018"
"García-Ayvens, Francisco"
],
"Place of Publication or Production": [
"Madison, Wisconsin"
Expand Down Expand Up @@ -3477,7 +3477,7 @@
],
"Summary": "Students look at the memorial in honor of Cesar Chavez outside the Chicano Studies Library. Pictured: Adele Martinez, unknown.",
"Topic": [
"Chavez, Cesar, 1927-1993",
"Chavez, Cesar",
"University of California, Berkeley. Chicano Studies Library",
"Library outreach"
],
Expand Down Expand Up @@ -3552,7 +3552,7 @@
"Personal Name": [
"Trujillo, Larry",
"Zapater, Marisol",
"Allen, Robert L., 1942-",
"Allen, Robert L.",
"Poon, Wei Chi"
],
"Place of Publication or Production": [
Expand Down
2 changes: 1 addition & 1 deletion site/_includes/components/heros/exhibits-carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2 class="text-center text-4xl tracking-tight font-bold pb-2">Explore the Exhib
pageDots: false,
lazyLoad: true,
pauseAutoPlayOnHover: false,
autoPlay: 3000
autoPlay: 3200
});

prevExhibitButton.addEventListener('click', () => exhibitCarousel.previous());
Expand Down
6 changes: 3 additions & 3 deletions site/_includes/components/items/carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2 class="text-center text-4xl tracking-tight font-bold pb-2">Archival Material
</div>
<div id="items-carousel" class="w-full">
{%- for item in items -%}
<div class="p-4 w-52 h-fit">
<div class="p-4 w-52">
{% include "partials/item-card.html" %}
</div>
{%- endfor -%}
Expand All @@ -33,9 +33,9 @@ <h2 class="text-center text-4xl tracking-tight font-bold pb-2">Archival Material
imagesLoaded: true,
prevNextButtons: false,
pageDots: false,
lazyLoad: true,
// lazyLoad: true,
pauseAutoPlayOnHover: false,
autoPlay: 2500
autoPlay: 2800
});

prevItemButton.addEventListener('click', () => itemCarousel.previous());
Expand Down
6 changes: 3 additions & 3 deletions site/_includes/partials/item-card.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{%- capture img_url -%}https://d1b7k5w7yjwpfg.cloudfront.net/iiif/2/bibliopolitica_{{ item.ID }}_{{ item.ID }}_001/full/800,/0/default.jpg{%- endcapture -%}
<a href="{{ '/item/'| append: item.ID | url }}.html">
<div class="h-full transition-all duration-500 hover:scale-105">
{% capture img_url %}https://d1b7k5w7yjwpfg.cloudfront.net/iiif/2/bibliopolitica_{{ item.ID }}_{{ item.ID }}_001/full/800,/0/default.jpg{% endcapture %}
<img loading="lazy" src="{{ img_url }}" class="h-full" alt="">
<div class="transition-all duration-500 hover:scale-105">
<img {% if lazy %}loading="lazy"{% endif %} src="{{ img_url }}" class="w-full h-auto block" alt="">
<div class="my-2 text-base leading-[1.4]">
{{ item.Label }}
</div>
Expand Down
41 changes: 22 additions & 19 deletions site/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ function toQueryString(tokens) {
}
}

function pruneDiacritics(str) {
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
}

function submitSearchQuery(idx) {
let query = '* *'
if (searchInput.value) {
input = searchInput.value;
input = pruneDiacritics(searchInput.value);
elem = document.querySelector(`[data='${searchInput.value}']`);
if (elem) { elem.classList.add('text-secondary'); }
tokens = input.split(' ');
query = toQueryString(tokens);
}
Expand Down Expand Up @@ -64,12 +70,18 @@ function inferUrlParams(){
}
}

function handleSearchBehavior(idx, resultsLookupMap){
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
}

function toDoc(doc) {
return {
'ID': doc.ID,
'Label': doc.Label,
'Personal_Name': (doc['Personal Name'] || []).join(' '),
'Summary': doc['Summary'] || '',
'Label': pruneDiacritics(doc.Label),
'Personal_Name': pruneDiacritics((doc['Personal Name'] || []).join(' ')),
'Summary': pruneDiacritics(doc['Summary']) || '',
'Topic': (doc['Topic'] || [] ).join(' '),
'Type': (doc['Type'] || [] ).join(' '),
'Format': (doc['Format'] || [] ).join(' ')
Expand Down Expand Up @@ -100,32 +112,23 @@ promisedData.then(function(data) {
this.add(toDoc(doc))
}, this)
})

inferUrlParams();
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
handleSearchBehavior(idx, resultsLookupMap);

document.body.addEventListener('keypress', function(e) {
if (e.key === "Enter") {
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
handleSearchBehavior(idx, resultsLookupMap);
}
});
searchSubmit.addEventListener('click', function() {
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
handleSearchBehavior(idx, resultsLookupMap);
}, false);
searchInput.addEventListener('keyup', function() {
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
handleSearchBehavior(idx, resultsLookupMap);
}, false);
searchLimit.addEventListener('change', function() {
results = submitSearchQuery(idx);
appendSearchInfo(results);
appendSearchResults(results, resultsLookupMap);
handleSearchBehavior(idx, resultsLookupMap);
}, false);
});

Loading

0 comments on commit 27d6b85

Please sign in to comment.