Skip to content

Commit

Permalink
Resource search remove auto-added http prefix (#334)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ikreymer committed Jun 19, 2024
1 parent 74266bf commit 2700797
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/url-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class URLResources extends LitElement {
firstUpdated() {
//this.doLoadResources();
if (this.urlSearchType === "") {
this.urlSearchType = "prefix";
this.urlSearchType = "contains";
}
}

Expand Down Expand Up @@ -163,14 +163,9 @@ class URLResources extends LitElement {
}

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;

// 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 params = new URLSearchParams({
Expand Down

0 comments on commit 2700797

Please sign in to comment.