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
083558ca
Commit
083558ca
authored
5 years ago
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
fcbb51c1
master
deploy/like-prod
deploy/like-stage
deploy/like-test
dev
like-pre/r01
test
1 merge request
!306
Master
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
14 deletions
+29
-14
es.py
libs/es.py
+29
-14
No files found.
libs/es.py
View file @
083558ca
...
@@ -288,25 +288,40 @@ class ESPerform(object):
...
@@ -288,25 +288,40 @@ class ESPerform(object):
def
get_tag_topic_list
(
cls
,
tag_id
,
have_read_topic_id_list
,
size
=
100
):
def
get_tag_topic_list
(
cls
,
tag_id
,
have_read_topic_id_list
,
size
=
100
):
try
:
try
:
functions_list
=
list
()
functions_list
=
list
()
for
id
in
tag_id
:
#
for id in tag_id:
functions_list
.
append
(
#
functions_list.append(
{
#
{
"filter"
:
{
"term"
:
{
"tag_list"
:
id
}},
#
"filter": {"term": {"tag_list": id}},
"weight"
:
1
#
"weight": 1
}
#
}
)
#
)
functions_list
+=
[
functions_list
+=
[
{
{
"filter"
:
{
"term"
:
{
"content_level"
:
6
}},
"filter"
:
{
"weight"
:
6000
"constant_score"
:{
"filter"
:{
"term"
:
{
"content_level"
:
6
}}
}
},
"weight"
:
60
},
},
{
{
"filter"
:
{
"term"
:
{
"content_level"
:
5
}},
"filter"
:
{
"weight"
:
5000
"constant_score"
:{
"filter"
:{
"term"
:
{
"content_level"
:
5
}}
}
},
"weight"
:
50
},
},
{
{
"filter"
:
{
"term"
:
{
"content_level"
:
4
}},
"filter"
:
{
"weight"
:
4000
"constant_score"
:{
"filter"
:{
"term"
:
{
"content_level"
:
4
}}
}
},
"weight"
:
40
}
}
]
]
q
=
{
q
=
{
...
@@ -333,7 +348,7 @@ class ESPerform(object):
...
@@ -333,7 +348,7 @@ class ESPerform(object):
"sort"
:
[
"sort"
:
[
{
"_score"
:
{
"order"
:
"desc"
}},
{
"_score"
:
{
"order"
:
"desc"
}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"language_type"
:
{
"order"
:
"asc"
}},
#
{"language_type": {"order": "asc"}},
]
]
}
}
if
len
(
have_read_topic_id_list
)
>
0
:
if
len
(
have_read_topic_id_list
)
>
0
:
...
...
This diff is collapsed.
Click to expand it.
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