internal/frontend: default to package mode if query is selected
When a user explicity selects "Package" from the dropdown, the m=package
query param will be set. In that case, always search packages,
regardless of our query heuristics.
For golang/go#44142
Change-Id: Icbbaa8d0a199a9b1228357dd631a5dfdba4cd317
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/346116
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/frontend/search.go b/internal/frontend/search.go
index 80e2250..f6902d0 100644
--- a/internal/frontend/search.go
+++ b/internal/frontend/search.go
@@ -397,10 +397,14 @@
}
return q, false
}
+ mode := strings.TrimSpace(r.FormValue("m"))
+ if mode == searchModePackage {
+ return q, false
+ }
if shouldDefaultToSymbolSearch(q) {
return q, true
}
- return q, strings.TrimSpace(r.FormValue("m")) == searchModeSymbol
+ return q, mode == searchModeSymbol
}
// shouldDefaultToSymbolSearch reports whether the search query is of the form