Skip to content

Commit 87a624a

Browse files
authored
Revert commits (#14608)
* Revert "commit assets" This reverts commit a0c5a7e. * Revert "include and down rank blog results" This reverts commit fa2d07e.
1 parent a0c5a7e commit 87a624a

File tree

3 files changed

+2
-34
lines changed

3 files changed

+2
-34
lines changed

assets/js/bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

layouts/partials/docs/search.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
id="search"
88
data-app-id="{{ getenv "ALGOLIA_APP_ID" }}"
99
data-search-key="{{ getenv "ALGOLIA_APP_SEARCH_KEY" }}"
10-
data-facets="Docs,Registry,Tutorials,Blog"
10+
data-facets="Docs,Registry,Tutorials"
1111
data-index="production"
1212
></div>
1313
</div>

theme/src/ts/algolia/autocomplete.ts

-32
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ import algoliasearch, { SearchClient } from "algoliasearch/lite";
22
import { autocomplete, getAlgoliaResults, getAlgoliaFacets } from "@algolia/autocomplete-js";
33
import { getTags, getTagsPlugin, setTags, Tag, iconForTag, labelForTag, mapTagsToFilters, groupBy, formatCount, debounce, listenForEvents } from "./utils";
44

5-
interface SearchResultHit {
6-
objectID: string;
7-
section: string;
8-
href: string;
9-
ancestors?: string[];
10-
h1?: string;
11-
title: string;
12-
}
13-
145
// CSS selector of the element to convert into an autocomplete control.
156
const autocompleteContainer = "#search";
167

@@ -118,29 +109,6 @@ function initAutocomplete(el: HTMLElement) {
118109
},
119110
},
120111
],
121-
// transformResponse is called for each set of results, allowing us to operate
122-
// on the result set before it is returned.
123-
transformResponse(results) {
124-
// Enables us to deprioritize blog results. We down rank them since we do not
125-
// want them competing with docs results in this portion of the site, but should
126-
// be shown in results as it is helpful when there are no results returned from
127-
// the other sections of the site.
128-
if (window.location.pathname.includes("/blog")) {
129-
return results.hits;
130-
}
131-
return results.hits.map(set => {
132-
// Sort results set and push blog results to the bottom.
133-
return set.sort((a: SearchResultHit, b: SearchResultHit) => {
134-
if (a.section === 'Blog' && b.section !== 'Blog') {
135-
return 1;
136-
}
137-
if (a.section !== 'Blog' && b.section === 'Blog') {
138-
return -1;
139-
}
140-
return 0;
141-
});
142-
});
143-
},
144112
})
145113
},
146114

0 commit comments

Comments
 (0)