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
钟尚武
physical
Commits
811580b4
Commit
811580b4
authored
Dec 04, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
6433a8c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
34 deletions
+2
-34
topic.py
search/utils/topic.py
+0
-33
pick_topic.py
trans2es/models/pick_topic.py
+1
-0
topic.py
trans2es/models/topic.py
+1
-1
No files found.
search/utils/topic.py
View file @
811580b4
...
...
@@ -184,25 +184,6 @@ class TopicUtils(object):
'fields'
:
query_fields
,
}
query_function_score
[
"query"
][
"bool"
][
"should"
]
.
append
({
'multi_match'
:
multi_match
})
"""
q["query"]["bool"] = {
"should": [
{'multi_match': multi_match}
],
"minimum_should_match": 1
}
"""
"""
if not is_first_time:
if group_topic_ids_index:
query_function_score["query"]["bool"]["must"]["range"]["group_id"] = {
"gt": 0
}
else:
query_function_score["query"]["bool"]["must"]["range"]["group_id"] = {
"lt": 0
}
"""
q
[
"query"
][
"function_score"
]
=
query_function_score
q
[
"_source"
]
=
{
...
...
@@ -213,20 +194,6 @@ class TopicUtils(object):
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
offset
=
offset
,
size
=
size
)
"""
group_topic_ids = list()
not_group_topic_ids = list()
q["filter"] = {
"range": {"content_level": {"gte": 3, "lte": 5}}
}
for item in result_dict["hits"]:
if item["_source"]["group_id"] and item["_source"]["group_id"]> 0:
group_topic_ids.append(item["_source"]["id"])
else:
not_group_topic_ids.append(item["_source"]["id"])
"""
if
len
(
result_dict
[
"hits"
])
>
0
:
return
[
item
[
"_source"
]
for
item
in
result_dict
[
"hits"
]]
else
:
...
...
trans2es/models/pick_topic.py
View file @
811580b4
...
...
@@ -15,6 +15,7 @@ class PickTopic(models.Model):
db_table
=
u"picktopic"
id
=
models
.
IntegerField
(
primary_key
=
True
,
verbose_name
=
u"主键ID"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
"是否删除"
)
topic_id
=
models
.
IntegerField
(
verbose_name
=
u"帖子ID"
)
pick_id
=
models
.
IntegerField
(
verbose_name
=
u"榜ID"
)
rank
=
models
.
IntegerField
(
verbose_name
=
u"排名"
)
...
...
trans2es/models/topic.py
View file @
811580b4
...
...
@@ -55,7 +55,7 @@ class Topic(models.Model):
def
get_pick_id_info
(
self
):
try
:
pick_id_list
=
list
()
query_list
=
PickTopic
.
objects
.
filter
(
topic_id
=
self
.
id
)
query_list
=
PickTopic
.
objects
.
filter
(
topic_id
=
self
.
id
,
is_deleted
=
False
)
for
item
in
query_list
:
pick_id_list
.
append
(
item
.
pick_id
)
...
...
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