restore + in sort

This commit is contained in:
Umputun
2018-05-06 13:56:52 -05:00
parent 66ff83cae5
commit 7870da30c2
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -216,7 +216,10 @@ func (s *Rest) updateCommentCtrl(w http.ResponseWriter, r *http.Request) {
func (s *Rest) findCommentsCtrl(w http.ResponseWriter, r *http.Request) {
locator := store.Locator{SiteID: r.URL.Query().Get("site"), URL: r.URL.Query().Get("url")}
sort := r.URL.Query().Get("sort")
log.Printf("[DEBUG] get comments for %+v, sort %s", locator, sort)
if strings.HasPrefix(sort, " ") { // restore + replaced by " "
sort = "+" + sort[1:]
}
log.Printf("[DEBUG] get comments for %+v, sort %s, format %s", locator, sort, r.URL.Query().Get("format"))
data, err := s.Cache.Get(rest.URLKey(r), time.Hour, func() ([]byte, error) {
comments, e := s.DataService.Find(locator, sort)
+1 -1
View File
@@ -1,6 +1,6 @@
### find request with tree
GET {{host}}/api/v1/find?site=remark&sort=-score&format=tree&url=https://radio-t.com/p/2017/12/16/podcast-576/
GET {{host}}/api/v1/find?site=remark&sort=+score&format=tree&url=https://radio-t.com/p/2017/12/16/podcast-576/
### find request with plain
GET {{host}}/api/v1/find?site=remark&sort=-score&format=plain&url=https://radio-t.com/p/2017/12/16/podcast-576/