internal/frontend: serve new search page behind experiment
Trust: Julie Qiu
Run-TryBot: Julie Qiu
TryBot-Result: kokoro
@@ -19,6 +19,7 @@ import (
"github.com/google/safehtml/template"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
+ "golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/log"
"golang.org/x/pkgsite/internal/postgres"
"golang.org/x/pkgsite/internal/version"
@@ -281,7 +282,12 @@ func (s *Server) serveSearch(w http.ResponseWriter, r *http.Request, ds internal
return fmt.Errorf("fetchSearchPage(ctx, db, %q): %v", query, err)
}
page.basePage = s.newBasePage(r, fmt.Sprintf("%s - Search Results", query))
- s.servePage(ctx, w, "legacy_search", page)
+
+ tmpl := "legacy_search"
+ if experiment.IsActive(ctx, internal.ExperimentSearchGrouping) {
+ tmpl = "search"
+ }
+ s.servePage(ctx, w, tmpl, page)
return nil
}
