es.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package model
  2. import (
  3. "encoding/json"
  4. )
  5. // ES .
  6. type ES struct {
  7. Addr string
  8. }
  9. // Page .
  10. type Page struct {
  11. Pn int `json:"num"`
  12. Ps int `json:"size"`
  13. Total int64 `json:"total"`
  14. }
  15. // SearchResult search result (deprecated).
  16. type SearchResult struct {
  17. Order string `json:"order"`
  18. Sort string `json:"sort"`
  19. Result []json.RawMessage `json:"result"`
  20. Debug string `json:"debug"`
  21. Page *Page `json:"page"`
  22. }
  23. // BasicSearchParams (deprecated).
  24. type BasicSearchParams struct {
  25. AppID string `form:"appid" params:"appid"`
  26. Pattern string `form:"pattern" params:"pattern" default:"equal"` //关键字匹配模式,完成匹配:equal,模糊查询:like
  27. KW string `form:"kw" params:"kw"`
  28. KwFields []string `form:"kw_fields,split" params:"kw_fields"`
  29. KWs []string `form:"kws,split" params:"kws"` //关键词组,用于AND OR连接
  30. Order []string `form:"order,split" params:"order"`
  31. Sort []string `form:"sort,split" params:"sort" default:"desc"`
  32. Pn int `form:"pn" params:"pn;Range(1,5000)" default:"1"`
  33. Ps int `form:"ps" params:"ps;Range(1,1000)" default:"10"`
  34. Highlight bool `form:"highlight" params:"highlight" default:"false"`
  35. ScoreFirst bool `form:"score_first" params:"score_first" default:"true"`
  36. Debug bool `form:"debug" params:"debug"`
  37. Source []string
  38. }
  39. // BasicMNGSearchParams .
  40. type BasicMNGSearchParams struct {
  41. Order string `form:"order" params:"order"`
  42. Sort string `form:"sort" params:"sort" default:"desc"`
  43. Pn int `form:"pn" params:"pn;Range(1,5000)" default:"1"`
  44. Ps int `form:"ps" params:"ps;Range(1,1000)" default:"10"`
  45. }
  46. // BasicUpdateParams (deprecated).
  47. type BasicUpdateParams struct {
  48. AppID string
  49. }
  50. // UpdateParams update params (deprecated).
  51. type UpdateParams map[string]interface{}