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
10a53839
Commit
10a53839
authored
Dec 08, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!9
parents
634485c7
f6979551
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
33 deletions
+40
-33
settings.py
physical/settings.py
+8
-1
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
+0
-0
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.
physical/settings.py
View file @
10a53839
...
...
@@ -30,7 +30,7 @@ ALLOWED_HOSTS = []
# Application definition
BROKER_URL
=
"redis://127.0.0.1:6379/
2
"
BROKER_URL
=
"redis://127.0.0.1:6379/
0
"
CELERY_TIMEZONE
=
'Asia/Shanghai'
CELERY_ROUTES
=
[
'physical.celery_task_router.CeleryTaskRouter'
]
...
...
@@ -94,7 +94,14 @@ DATABASES = {
},
}
}
ES_INFO_LIST
=
[
{
"host"
:
"10.29.130.141"
,
"port"
:
9200
}
]
ES_INDEX_PREFIX
=
"gm-dbmw"
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
...
...
search/utils/group.py
View file @
10a53839
...
...
@@ -27,11 +27,10 @@ class GroupUtils(object):
q
[
'query'
]
=
{
'bool'
:
{
"must"
:
{
"term"
:{
"is_online"
:
True
}
},
"must"
:
[
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
],
"should"
:
[
{
'multi_match'
:
multi_match
}
],
...
...
@@ -53,11 +52,10 @@ class GroupUtils(object):
q
=
dict
()
q
[
"query"
]
=
{
"bool"
:{
"must"
:{
"term"
:{
"is_online"
:
True
}
}
"must"
:[
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
}
}
q
[
"sort"
]
=
[
...
...
@@ -88,15 +86,11 @@ class GroupUtils(object):
q
=
dict
()
q
[
"query"
]
=
{
"bool"
:{
"should"
:[
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"user_id"
:
user_id
}}
],
"minimum_should_match"
:
2
"must"
:[
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"user_id"
:
user_id
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
}
}
q
[
"_source"
]
=
{
...
...
search/utils/pick.py
View file @
10a53839
...
...
@@ -63,7 +63,8 @@ class PickUtils(object):
},
"must"
:[
{
"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):
"bool"
:{
"must"
:[
{
"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):
"bool"
:{
"must"
:[
{
"term"
:{
"pick_id_list"
:
pick_id
}},
{
"term"
:{
"is_online"
:
True
}}
{
"term"
:{
"is_online"
:
True
}},
{
"term"
:{
"is_deleted"
:
False
}}
]
}
}
...
...
search/utils/user.py
View file @
10a53839
...
...
@@ -94,11 +94,11 @@ class UserUtils(object):
query_function_score
=
{
"query"
:
{
"bool"
:
{
"
should
"
:
[
"
must
"
:
[
{
"term"
:
{
"is_recommend"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
],
"minimum_should_match"
:
2
,
"must_not"
:{
"terms"
:{
"user_id"
:
self_attention_user_id_list
...
...
search/views/topic.py
View file @
10a53839
trans2es/mapping/celebrity.json
View file @
10a53839
...
...
@@ -5,8 +5,8 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"portrait"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"gender"
:{
"type"
:
"integer"
},
"city_id"
:{
"type"
:
"text"
},
"pick_id_list"
:{
"type"
:
"long"
},
...
...
trans2es/mapping/group.json
View file @
10a53839
...
...
@@ -5,8 +5,8 @@
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"is_recommend"
:{
"type"
:
"boolean"
},
"name"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"topic_num"
:{
"type"
:
"long"
},
"creator_id"
:{
"type"
:
"long"
},
"icon"
:{
"type"
:
"text"
},
...
...
trans2es/mapping/topic.json
View file @
10a53839
...
...
@@ -3,11 +3,12 @@
"properties"
:
{
"id"
:{
"type"
:
"long"
},
"is_online"
:{
"type"
:
"boolean"
},
//上线
"is_deleted"
:{
"type"
:
"boolean"
},
"vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
},
"description"
:{
"type"
:
"text"
},
"content"
:{
"type"
:
"text"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"content_level"
:{
"type"
:
"text"
},
"user_id"
:{
"type"
:
"long"
},
"group_id"
:{
"type"
:
"long"
},
//所在组ID
...
...
trans2es/mapping/user.json
View file @
10a53839
...
...
@@ -3,10 +3,11 @@
"properties"
:
{
"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"
},
//头像
"gender"
:{
"type"
:
"integer"
},
"is_online"
:{
"type"
:
"boolean"
},
//是否上线
"is_deleted"
:{
"type"
:
"boolean"
},
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"city_id"
:{
"type"
:
"text"
},
"country_id"
:{
"type"
:
"long"
},
...
...
trans2es/models/user.py
View file @
10a53839
...
...
@@ -30,6 +30,7 @@ class User(models.Model):
city_id
=
models
.
CharField
(
verbose_name
=
u'城市id'
,
max_length
=
40
)
country_id
=
models
.
IntegerField
(
verbose_name
=
'国家id'
)
is_online
=
models
.
BooleanField
(
verbose_name
=
"是否上线"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
create_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