`
+ : nothing}
${repeat(
this.smartFacets,
f =>
From 29b997c412a1fb26ec629277f2f0caaad8dd7b1c Mon Sep 17 00:00:00 2001
From: Laton Vermette <1619661+latonv@users.noreply.github.com>
Date: Mon, 2 Jun 2025 17:24:34 -0700
Subject: [PATCH 09/18] Hide smart facets if query is cleared
---
src/collection-browser.ts | 2 +-
src/collection-facets/smart-facets/smart-facet-bar.ts | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/collection-browser.ts b/src/collection-browser.ts
index 0d60c4323..159763303 100644
--- a/src/collection-browser.ts
+++ b/src/collection-browser.ts
@@ -509,7 +509,7 @@ export class CollectionBrowser
render() {
return html`
${this.showSmartFacetBar
- ? html`
`
: nothing}
@@ -687,11 +688,14 @@ export class CollectionBrowser
* tiles and sort/filter bar are shown.
*/
private get rightColumnTemplate(): TemplateResult {
+ const rightColumnClasses = classMap({
+ column: true,
+ 'full-width': this.showSmartFacetBar && !this.facetPaneVisible,
+ 'smart-results-spacing': !!this.showSmartResults,
+ });
+
return html`
-
+
${this.showSmartResults
? html``
: nothing}
@@ -1672,6 +1676,18 @@ export class CollectionBrowser
);
}
+ /**
+ * Emits a `facetPaneVisibilityChanged` event indicating that the facet pane has
+ * been toggled open or closed.
+ */
+ private emitFacetPaneVisibilityChanged(): void {
+ this.dispatchEvent(
+ new CustomEvent('facetPaneVisibilityChanged', {
+ detail: this.facetPaneVisible,
+ }),
+ );
+ }
+
/**
* Emits a `queryStateChanged` event indicating that one or more of this component's
* properties have changed in a way that could affect the set of search results.
@@ -2216,13 +2232,16 @@ export class CollectionBrowser
flex: 1;
position: relative;
min-height: 90vh;
- border-left: 1px solid rgb(232, 232, 232);
border-right: 1px solid rgb(232, 232, 232);
margin-top: var(--rightColumnMarginTop, 0);
padding-top: 2rem;
background: #fff;
}
+ #left-column:not([hidden]) + #right-column {
+ border-left: 1px solid rgb(232, 232, 232);
+ }
+
#right-column.smart-results-spacing {
padding-top: 0.5rem;
border-right: none;
From 8f64f6e1ef61ceb7758836b9f14ee80db2411eef Mon Sep 17 00:00:00 2001
From: Laton Vermette <1619661+latonv@users.noreply.github.com>
Date: Thu, 5 Jun 2025 12:46:21 -0700
Subject: [PATCH 16/18] Suppress mediatype-only facets from heuristics
---
src/collection-facets/smart-facets/smart-facet-bar.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/collection-facets/smart-facets/smart-facet-bar.ts b/src/collection-facets/smart-facets/smart-facet-bar.ts
index 614bd5e79..afb91fe11 100644
--- a/src/collection-facets/smart-facets/smart-facet-bar.ts
+++ b/src/collection-facets/smart-facets/smart-facet-bar.ts
@@ -175,6 +175,10 @@ export class SmartFacetBar extends LitElement {
if (this.heuristicRecs.length > 0) {
for (const rec of this.heuristicRecs) {
+ // Suppress mediatype-only facets for now.
+ if (rec.facets.length === 1 && rec.facets[0].facetType === 'mediatype')
+ continue;
+
facets.push([rec]);
}
}
@@ -219,10 +223,6 @@ export class SmartFacetBar extends LitElement {
if (facetType === 'mediatype') {
continue;
// Don't include mediatype bubbles
- // facets.push(
- // [this.toSmartFacet(facetType, [unusedBuckets[0]])],
- // [this.toSmartFacet(facetType, [unusedBuckets[1]])],
- // );
} else if (facetType === 'collection' || facetType === 'subject') {
const topBuckets = unusedBuckets.slice(0, 5);
facets.push(topBuckets.map(b => this.toSmartFacet(facetType, [b])));
From e2debb11eea03235014db081ea5d0a0689dd3e31 Mon Sep 17 00:00:00 2001
From: Laton Vermette <1619661+latonv@users.noreply.github.com>
Date: Wed, 11 Jun 2025 17:05:11 -0700
Subject: [PATCH 17/18] Add missing unit test
---
test/collection-browser.test.ts | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/test/collection-browser.test.ts b/test/collection-browser.test.ts
index 42a1a4ad2..c5224b248 100644
--- a/test/collection-browser.test.ts
+++ b/test/collection-browser.test.ts
@@ -2044,4 +2044,23 @@ describe('Collection Browser', () => {
const initialResults = el.dataSource.getAllPages();
expect(Object.keys(initialResults).length).to.deep.equal(numberOfPages);
});
+
+ it('renders provided results header instead of default, when showing smart results', async () => {
+ const searchService = new MockSearchService();
+
+ const el = await fixture(
+ html``,
+ );
+
+ el.baseQuery = 'foo';
+ await el.updateComplete;
+ await nextTick();
+
+ const header = el.shadowRoot?.querySelector('.results-section-heading');
+ expect(header?.textContent?.trim()).to.equal('Foo Bar');
+ });
});
From 2e618250ab0dcb072e77e22fb3f58be052b7dcd4 Mon Sep 17 00:00:00 2001
From: Laton Vermette <1619661+latonv@users.noreply.github.com>
Date: Wed, 11 Jun 2025 17:48:02 -0700
Subject: [PATCH 18/18] Upgrade off alpha search-service
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index fa397ca01..60cc553ce 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"@internetarchive/iaux-item-metadata": "^1.0.4",
"@internetarchive/infinite-scroller": "^1.0.1",
"@internetarchive/modal-manager": "^2.0.1",
- "@internetarchive/search-service": "2.0.1-alpha-webdev7090.1",
+ "@internetarchive/search-service": "^2.1.0",
"@internetarchive/shared-resize-observer": "^0.2.0",
"@lit/localize": "^0.12.2",
"dompurify": "^3.2.4",
diff --git a/yarn.lock b/yarn.lock
index f5bf11daa..c81b4d197 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -407,10 +407,10 @@
resolved "https://registry.yarnpkg.com/@internetarchive/result-type/-/result-type-0.0.1.tgz#a1bda4428dc557cc644a67783f1b8d5944ae4d54"
integrity sha512-sWahff5oP1xAK1CwAu1/5GTG2RXsdx/sQKn4SSOWH0r0vU2QoX9kAom/jSXeBsmgK0IjTc+9Ty9407SMORi+nQ==
-"@internetarchive/search-service@2.0.1-alpha-webdev7090.1":
- version "2.0.1-alpha-webdev7090.1"
- resolved "https://registry.yarnpkg.com/@internetarchive/search-service/-/search-service-2.0.1-alpha-webdev7090.1.tgz#8443e2f3317016ccc99738c865e5b9ba85906946"
- integrity sha512-flHZsLBxG+Rvau/hNiNhkCKyK48gjjtFR+2daupNlgiZAZeL83W7en+nleC0+qkyUTfuqpsFxJorteqbGH2VIQ==
+"@internetarchive/search-service@^2.1.0":
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/@internetarchive/search-service/-/search-service-2.1.0.tgz#7cceac2ff0055904a47c21248c95142865f37337"
+ integrity sha512-amEwRNvEgOcxPvgDLuQPWKeJIH68c7cWxtijAesWIwav4cH3K7ZR8LCJXzFMCx4Y1FWq8zrYx33jn5lvgCSUjg==
dependencies:
"@internetarchive/iaux-item-metadata" "^1.0.4"
"@internetarchive/result-type" "^0.0.1"