Merge pull request #143 from alimy/main

optimize #141 fixed zinc search not in expect result
pull/144/head
Michael Li 2 years ago committed by GitHub
commit 9012c8641d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ import (
"github.com/rocboss/paopao-ce/internal/model" "github.com/rocboss/paopao-ce/internal/model"
"github.com/rocboss/paopao-ce/pkg/json" "github.com/rocboss/paopao-ce/pkg/json"
"github.com/rocboss/paopao-ce/pkg/zinc" "github.com/rocboss/paopao-ce/pkg/zinc"
"github.com/sirupsen/logrus"
) )
func newZincTweetSearchServant() *zincTweetSearchServant { func newZincTweetSearchServant() *zincTweetSearchServant {
@ -74,8 +75,15 @@ func (s *zincTweetSearchServant) Search(user *model.User, q *core.QueryReq, offs
resp, err = s.queryByContent(user, q, offset, limit) resp, err = s.queryByContent(user, q, offset, limit)
} else if q.Type == core.SearchTypeTag && q.Query != "" { } else if q.Type == core.SearchTypeTag && q.Query != "" {
resp, err = s.queryByTag(user, q, offset, limit) resp, err = s.queryByTag(user, q, offset, limit)
} else {
resp, err = s.queryAny(user, offset, limit)
}
if err != nil {
logrus.Errorf("zincTweetSearchServant.search searchType:%s query:%s error:%v", q.Type, q.Query, err)
return
} }
resp, err = s.queryAny(user, offset, limit)
logrus.Debugf("zincTweetSearchServant.Search type:%s query:%s resp Hits:%d NbHits:%d offset: %d limit:%d ", q.Type, q.Query, len(resp.Items), resp.Total, offset, limit)
s.filterResp(user, resp) s.filterResp(user, resp)
return return
} }

Loading…
Cancel
Save