all repos — searchix @ a5f58bc7fe205b8ff84f6b654513e40bfbc61ae9

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: opensearch searches not using input query
Alan Pearce alan@alanpearce.eu
Fri, 12 Jul 2024 21:10:47 +0200
commit

a5f58bc7fe205b8ff84f6b654513e40bfbc61ae9

parent

9440d2fc4250e733e1dbe25303bd2407642ff28c

2 files changed, 3 insertions(+), 5 deletions(-)

jump to
M internal/config/config.gointernal/config/config.go
@@ -35,10 +35,8 @@ func (u *URL) JoinPath(elems ...string) *URL { 	return &URL{u.URL.JoinPath(elems...)}
 }
 
-func (u *URL) AddQuery(key, value string) *URL {
-	q := u.URL.Query()
-	q.Add(key, value)
-	u.RawQuery = q.Encode()
+func (u *URL) AddRawQuery(key, value string) *URL {
+	u.RawQuery = key + "=" + value
 
 	return u
 }
M internal/server/mux.gointernal/server/mux.go
@@ -295,7 +295,7 @@ Template: cfg.Web.BaseURL.JoinPath( 						source.Importer.String(),
 						source.Key,
 						"search",
-					).AddQuery("query", "{searchTerms}"),
+					).AddRawQuery("query", "{searchTerms}"),
 				},
 			}
 			enc := xml.NewEncoder(w)