|
|
@@ -0,0 +1,115 @@
|
|
|
+package models
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type QueryObjecct struct {
|
|
|
+ Query struct {
|
|
|
+ Bool struct {
|
|
|
+ Must []interface{} `json:"must,omitempty"`
|
|
|
+ MustNot []interface{} `json:"must_not,omitempty"`
|
|
|
+ Should []interface{} `json:"should,omitempty"`
|
|
|
+ } `json:"bool"`
|
|
|
+ } `json:"query"`
|
|
|
+ Size int `json:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+//通用匹配 Must
|
|
|
+type MustObject struct {
|
|
|
+ //省市县
|
|
|
+ AreaCityDistrict *AreaCityDistrict `json:"term,omitempty"`
|
|
|
+ //一级分类、二级分类
|
|
|
+ ToptypeSubtype *ToptypeSubtype `json:"terms,omitempty"`
|
|
|
+ //时间范围
|
|
|
+ Publishtime *Publishtime `json:"range,omitempty"`
|
|
|
+ //字段是或否存在
|
|
|
+ ExistfieldsObject *ExistfieldsObject `json:"constant_score,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//时间范围
|
|
|
+type Publishtime struct {
|
|
|
+ //查询时间
|
|
|
+ PublishtimeObject struct {
|
|
|
+ Gte int `json:"gte"`
|
|
|
+ Lt int `json:"lt"`
|
|
|
+ } `json:"publishtime,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//省市县
|
|
|
+type AreaCityDistrict struct {
|
|
|
+ Area string `json:"area,omitempty"`
|
|
|
+ City string `json:"city,omitempty"`
|
|
|
+ District string `json:"district,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//一级分类、二级分类
|
|
|
+type ToptypeSubtype struct {
|
|
|
+ Toptype []string `json:"toptype,omitempty"`
|
|
|
+ Subtype []string `json:"subtype,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//字段存在 存在放MustNot,字符串为空忽略
|
|
|
+type ExistfieldsObject struct {
|
|
|
+ Filter struct {
|
|
|
+ Missing struct {
|
|
|
+ Field []string `json:"field,omitempty"`
|
|
|
+ } `json:"missing,omitempty"`
|
|
|
+ } `json:"filter,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//全局附加词 should
|
|
|
+type GlobaladdkeyObject struct {
|
|
|
+ MatchPhrase *MatchPhrase `json:"match_phrase,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//全局排除词 must_not
|
|
|
+type GlobalnotkeyObject struct {
|
|
|
+ MatchPhrase *MatchPhrase `json:"match_phrase,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//匹配方式
|
|
|
+type MatchPhrase struct {
|
|
|
+ Title string `json:"title,omitempty"`
|
|
|
+ Detail string `json:"detail,omitempty"`
|
|
|
+ Purchasing string `json:"purchasing,omitempty"`
|
|
|
+ Attachments string `json:"attachments,omitempty"`
|
|
|
+ Projectname string `json:"projectname,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//关键词 should
|
|
|
+type MatchkeyObject struct {
|
|
|
+ MatchPhrase *MatchPhrase `json:"match_phrase"`
|
|
|
+}
|
|
|
+
|
|
|
+//附件词 should
|
|
|
+type AddkeyObject struct {
|
|
|
+ MatchPhrase *MatchPhrase `json:"match_phrase"`
|
|
|
+}
|
|
|
+
|
|
|
+//排除词 must_not
|
|
|
+type NotkeyObject struct {
|
|
|
+ MatchPhrase *MatchPhrase `json:"match_phrase"`
|
|
|
+}
|
|
|
+
|
|
|
+//采购单位行业 should
|
|
|
+type BuyerclassObject struct {
|
|
|
+ Terms struct {
|
|
|
+ Buyerclass []string `json:"buyerclass,omitempty"`
|
|
|
+ } `json:"terms,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//公告行业二级 should
|
|
|
+type SubscopeclassObject struct {
|
|
|
+ Terms struct {
|
|
|
+ Subscopeclass []string `json:"s_subscopeclass,omitempty"`
|
|
|
+ } `json:"terms,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+//xf should
|
|
|
+type NewObject struct {
|
|
|
+ Bool struct {
|
|
|
+ Must []interface{} `json:"must,omitempty"`
|
|
|
+ MustNot []interface{} `json:"must_not,omitempty"`
|
|
|
+ Should []interface{} `json:"should,omitempty"`
|
|
|
+ } `json:"bool,omitempty"`
|
|
|
+}
|
|
|
+
|