Resource search remove auto-added http prefix (#334)

- remove previous optimization that auto-added 'https://' prefix to search
queries, which resulted in 'urn:' resources not being searchable.
also caused unintuitive behavior, where 'ht' would show no results while
'http' would, now fixed. Results in more predictable search results in
the end.
- Also default to contains instead of prefix search by default
This commit is contained in:
Ilya Kreymer
2024-06-18 18:38:48 -07:00
committed by GitHub
parent 74266bf3b3
commit 2700797b6a
+2 -7
View File
@@ -112,7 +112,7 @@ class URLResources extends LitElement {
firstUpdated() { firstUpdated() {
//this.doLoadResources(); //this.doLoadResources();
if (this.urlSearchType === "") { if (this.urlSearchType === "") {
this.urlSearchType = "prefix"; this.urlSearchType = "contains";
} }
} }
@@ -163,14 +163,9 @@ class URLResources extends LitElement {
} }
this.loading = true; this.loading = true;
let url = this.urlSearchType !== "contains" ? this.query : ""; const url = this.urlSearchType !== "contains" ? this.query : "";
const prefix = url && this.urlSearchType === "prefix" ? 1 : 0; const prefix = url && this.urlSearchType === "prefix" ? 1 : 0;
// optimization: if not starting with http, likely won't have a match here, so just add https://
if (url && !url.startsWith("http")) {
url = "https://" + url;
}
const mime = this.currMime; const mime = this.currMime;
const params = new URLSearchParams({ const params = new URLSearchParams({