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
dd446861
Commit
dd446861
authored
May 09, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ed24f39e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
topic.py
search/utils/topic.py
+40
-0
business_topic.py
search/views/business_topic.py
+1
-1
No files found.
search/utils/topic.py
View file @
dd446861
...
@@ -956,3 +956,43 @@ class TopicUtils(object):
...
@@ -956,3 +956,43 @@ class TopicUtils(object):
"hits"
:
[],
"hits"
:
[],
"total_count"
:
0
"total_count"
:
0
}
}
@classmethod
def
business_filters
(
cls
,
filters
,
filter_online
=
True
):
"""处理过滤器部分。"""
logging
.
info
(
"get filters:
%
s"
%
filters
)
f
=
[
{
"term"
:
{
"is_deleted"
:
False
}},
]
if
not
filters
:
return
f
if
filter_online
:
f
.
append
({
"term"
:
{
"is_online"
:
True
}})
for
k
,
v
in
filters
.
items
():
if
v
in
(
None
,
''
,
[]):
continue
if
k
==
"content"
:
f
.
append
({
"match"
:
{
k
:
v
}
})
elif
k
==
"virtual_content_level"
:
f
.
append
({
"match"
:
{
k
:
v
}
})
else
:
f
.
append
({
"term"
:
{
k
:
v
},
})
return
f
search/views/business_topic.py
View file @
dd446861
...
@@ -19,7 +19,7 @@ def business_topic_search(filters, nfilters=None, sorts_by=None, offset=0, size=
...
@@ -19,7 +19,7 @@ def business_topic_search(filters, nfilters=None, sorts_by=None, offset=0, size=
try
:
try
:
result_list
=
TopicUtils
.
business_
topic_id
s
(
result_list
=
TopicUtils
.
business_
filter
s
(
filters
=
filters
,
nfilters
=
nfilters
,
sorts_by
=
sorts_by
,
filters
=
filters
,
nfilters
=
nfilters
,
sorts_by
=
sorts_by
,
offset
=
offset
,
size
=
size
,
filter_online
=
False
,
offset
=
offset
,
size
=
size
,
filter_online
=
False
,
index_name
=
"topic"
index_name
=
"topic"
...
...
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