From b961e74656b0db97d5b3c14295ca8c6ba16b4424 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 11 Apr 2017 14:51:22 -0700 Subject: change implementation of search to opt-in per type, less risky if sensative data is added --- system/api/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/api') diff --git a/system/api/search.go b/system/api/search.go index ae6ac1c..25a1bae 100644 --- a/system/api/search.go +++ b/system/api/search.go @@ -44,7 +44,7 @@ func searchContentHandler(res http.ResponseWriter, req *http.Request) { // execute search for query provided, if no index for type send 404 matches, err := db.SearchType(t, q) if err == db.ErrNoSearchIndex { - res.WriteHeader(http.StatusBadRequest) + res.WriteHeader(http.StatusNotFound) return } if err != nil { -- cgit v1.2.3 From 715b2e5b32a4603e1eb580133b9ae1a5837760fc Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 11 Apr 2017 18:31:54 -0700 Subject: adding push support to search, only first matched result --- system/api/search.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/api') diff --git a/system/api/search.go b/system/api/search.go index 25a1bae..c743d9f 100644 --- a/system/api/search.go +++ b/system/api/search.go @@ -61,6 +61,11 @@ func searchContentHandler(res http.ResponseWriter, req *http.Request) { return } + // if we have matches, push the first as its matched by relevance + if len(bb) > 0 { + push(res, req, it, bb[0]) + } + var result = []json.RawMessage{} for i := range bb { result = append(result, bb[i]) -- cgit v1.2.3