Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
f6979551
Commit
f6979551
authored
Dec 08, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
51e5a3a6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
33 deletions
+33
-33
group.py
search/utils/group.py
+13
-19
pick.py
search/utils/pick.py
+6
-3
user.py
search/utils/user.py
+2
-2
topic.py
search/views/topic.py
+1
-1
celebrity.json
trans2es/mapping/celebrity.json
+2
-2
group.json
trans2es/mapping/group.json
+2
-2
topic.json
trans2es/mapping/topic.json
+4
-3
user.json
trans2es/mapping/user.json
+2
-1
user.py
trans2es/models/user.py
+1
-0
No files found.
search/utils/group.py
View file @
f6979551
...
@@ -27,11 +27,10 @@ class GroupUtils(object):
...
@@ -27,11 +27,10 @@ class GroupUtils(object):
q
[
'query'
]
=
{
q
[
'query'
]
=
{
'bool'
:
{
'bool'
:
{
"must"
:
{
"must"
:
[
"term"
:{
{
"term"
:
{
"is_online"
:
True
}},
"is_online"
:
True
{
"term"
:
{
"is_deleted"
:
False
}}
}
],
},
"should"
:
[
"should"
:
[
{
'multi_match'
:
multi_match
}
{
'multi_match'
:
multi_match
}
],
],
...
@@ -53,11 +52,10 @@ class GroupUtils(object):
...
@@ -53,11 +52,10 @@ class GroupUtils(object):
q
=
dict
()
q
=
dict
()
q
[
"query"
]
=
{
q
[
"query"
]
=
{
"bool"
:{
"bool"
:{
"must"
:{
"must"
:[
"term"
:{
{
"term"
:
{
"is_online"
:
True
}},
"is_online"
:
True
{
"term"
:{
"is_deleted"
:
False
}}
}
]
}
}
}
}
}
q
[
"sort"
]
=
[
q
[
"sort"
]
=
[
...
@@ -88,15 +86,11 @@ class GroupUtils(object):
...
@@ -88,15 +86,11 @@ class GroupUtils(object):
q
=
dict
()
q
=
dict
()
q
[
"query"
]
=
{
q
[
"query"
]
=
{
"bool"
:{
"bool"
:{
"should"
:[
"must"
:[
{
"term"
:{
{
"term"
:{
"is_online"
:
True
}},
"is_online"
:
True
{
"term"
:{
"user_id"
:
user_id
}},
}},
{
"term"
:{
"is_deleted"
:
False
}}
{
"term"
:{
]
"user_id"
:
user_id
}}
],
"minimum_should_match"
:
2
}
}
}
}
q
[
"_source"
]
=
{
q
[
"_source"
]
=
{
...
...
search/utils/pick.py
View file @
f6979551
...
@@ -63,7 +63,8 @@ class PickUtils(object):
...
@@ -63,7 +63,8 @@ class PickUtils(object):
},
},
"must"
:[
"must"
:[
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"is_online"
:
True
}}
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
]
}
}
}
}
...
@@ -108,7 +109,8 @@ class PickUtils(object):
...
@@ -108,7 +109,8 @@ class PickUtils(object):
"bool"
:{
"bool"
:{
"must"
:[
"must"
:[
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"is_online"
:
True
}}
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
]
}
}
}
}
...
@@ -150,7 +152,8 @@ class PickUtils(object):
...
@@ -150,7 +152,8 @@ class PickUtils(object):
"bool"
:{
"bool"
:{
"must"
:[
"must"
:[
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"is_online"
:
True
}}
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
]
}
}
}
}
...
...
search/utils/user.py
View file @
f6979551
...
@@ -94,11 +94,11 @@ class UserUtils(object):
...
@@ -94,11 +94,11 @@ class UserUtils(object):
query_function_score
=
{
query_function_score
=
{
"query"
:
{
"query"
:
{
"bool"
:
{
"bool"
:
{
"
should
"
:
[
"
must
"
:
[
{
"term"
:
{
"is_recommend"
:
True
}},
{
"term"
:
{
"is_recommend"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
],
],
"minimum_should_match"
:
2
,
"must_not"
:{
"must_not"
:{
"terms"
:{
"terms"
:{
"user_id"
:
self_attention_user_id_list
"user_id"
:
self_attention_user_id_list
...
...
search/views/topic.py
View file @
f6979551
...
@@ -146,7 +146,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
...
@@ -146,7 +146,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
try
:
try
:
if
not
isinstance
(
user_id
,
int
):
if
not
isinstance
(
user_id
,
int
):
user_id
=
-
1
user_id
=
-
1
# 获取帖子标签列表
# 获取帖子标签列表
topic_tag_list
=
TopicUtils
.
get_topic_tag_id_list
(
topic_id
)
topic_tag_list
=
TopicUtils
.
get_topic_tag_id_list
(
topic_id
)
...
...
trans2es/mapping/celebrity.json
View file @
f6979551
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"is_deleted"
:{
"type"
:
"boolean"
},
"portrait"
:{
"type"
:
"text"
},
"portrait"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"gender"
:{
"type"
:
"integer"
},
"gender"
:{
"type"
:
"integer"
},
"city_id"
:{
"type"
:
"text"
},
"city_id"
:{
"type"
:
"text"
},
"pick_id_list"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
...
...
trans2es/mapping/group.json
View file @
f6979551
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"is_deleted"
:{
"type"
:
"boolean"
},
"is_recommend"
:{
"type"
:
"boolean"
},
"is_recommend"
:{
"type"
:
"boolean"
},
"name"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"topic_num"
:{
"type"
:
"long"
},
"topic_num"
:{
"type"
:
"long"
},
"creator_id"
:{
"type"
:
"long"
},
"creator_id"
:{
"type"
:
"long"
},
"icon"
:{
"type"
:
"text"
},
"icon"
:{
"type"
:
"text"
},
...
...
trans2es/mapping/topic.json
View file @
f6979551
...
@@ -3,11 +3,12 @@
...
@@ -3,11 +3,12 @@
"properties"
:
{
"properties"
:
{
"id"
:{
"type"
:
"long"
},
"id"
:{
"type"
:
"long"
},
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"vote_num"
:{
"type"
:
"long"
},
"vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"content"
:{
"type"
:
"text"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"content_level"
:{
"type"
:
"text"
},
"content_level"
:{
"type"
:
"text"
},
"user_id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"group_id"
:{
"type"
:
"long"
},
//所在组ID
...
...
trans2es/mapping/user.json
View file @
f6979551
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
"properties"
:
{
"properties"
:
{
"id"
:{
"type"
:
"long"
},
"id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"nick_name"
:{
"type"
:
"text"
},
//昵称
"nick_name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
//昵称
"profile_pic"
:{
"type"
:
"text"
},
//头像
"profile_pic"
:{
"type"
:
"text"
},
//头像
"gender"
:{
"type"
:
"integer"
},
"gender"
:{
"type"
:
"integer"
},
"is_online"
:{
"type"
:
"boolean"
},
//是否上线
"is_online"
:{
"type"
:
"boolean"
},
//是否上线
"is_deleted"
:{
"type"
:
"boolean"
},
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"city_id"
:{
"type"
:
"text"
},
"city_id"
:{
"type"
:
"text"
},
"country_id"
:{
"type"
:
"long"
},
"country_id"
:{
"type"
:
"long"
},
...
...
trans2es/models/user.py
View file @
f6979551
...
@@ -30,6 +30,7 @@ class User(models.Model):
...
@@ -30,6 +30,7 @@ class User(models.Model):
city_id
=
models
.
CharField
(
verbose_name
=
u'城市id'
,
max_length
=
40
)
city_id
=
models
.
CharField
(
verbose_name
=
u'城市id'
,
max_length
=
40
)
country_id
=
models
.
IntegerField
(
verbose_name
=
'国家id'
)
country_id
=
models
.
IntegerField
(
verbose_name
=
'国家id'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
"是否上线"
)
is_online
=
models
.
BooleanField
(
verbose_name
=
"是否上线"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
update_time
=
models
.
DateTimeField
(
verbose_name
=
u'更新时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment