From 2700797b6a8c6ff011cb22274d65ca7853b358b4 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 18 Jun 2024 18:38:48 -0700 Subject: [PATCH] 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 --- src/url-resources.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/url-resources.ts b/src/url-resources.ts index 369ec2b..86a53c9 100644 --- a/src/url-resources.ts +++ b/src/url-resources.ts @@ -112,7 +112,7 @@ class URLResources extends LitElement { firstUpdated() { //this.doLoadResources(); if (this.urlSearchType === "") { - this.urlSearchType = "prefix"; + this.urlSearchType = "contains"; } } @@ -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({