From a5f58bc7fe205b8ff84f6b654513e40bfbc61ae9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Jul 2024 21:10:47 +0200 Subject: fix: opensearch searches not using input query --- internal/config/config.go | 6 ++---- internal/server/mux.go | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index f3c0b57..b5f2ee4 100644 --- a/internal/config/config.go +++ b/internal/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 } diff --git a/internal/server/mux.go b/internal/server/mux.go index 8c34599..e869e14 100644 --- a/internal/server/mux.go +++ b/internal/server/mux.go @@ -295,7 +295,7 @@ func NewMux( source.Importer.String(), source.Key, "search", - ).AddQuery("query", "{searchTerms}"), + ).AddRawQuery("query", "{searchTerms}"), }, } enc := xml.NewEncoder(w) -- cgit 1.4.1