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
09bace70
Commit
09bace70
authored
Jan 25, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update contrast_similar
parent
696aa7e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
app_conf.xml
app_conf.xml
+1
-0
contrast_similar.py
search/views/contrast_similar.py
+13
-9
No files found.
app_conf.xml
View file @
09bace70
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<element
value=
"search.views.group"
/>
<element
value=
"search.views.group"
/>
<element
value=
"search.views.user"
/>
<element
value=
"search.views.user"
/>
<element
value=
"search.views.tag"
/>
<element
value=
"search.views.tag"
/>
<element
value=
"search.views.contrast_similar"
/>
<element
value=
"injection.data_sync.tasks"
/>
<element
value=
"injection.data_sync.tasks"
/>
</config>
</config>
</gm_rpcd_config>
</gm_rpcd_config>
search/views/contrast_similar.py
View file @
09bace70
...
@@ -23,7 +23,7 @@ MAX_LOAD = 100
...
@@ -23,7 +23,7 @@ MAX_LOAD = 100
GROUP_SIZE
=
10
GROUP_SIZE
=
10
@bind
(
'
doris
/search/query_contrast_similar'
)
@bind
(
'
physical
/search/query_contrast_similar'
)
def
contrast_similar
(
user_id
,
offset
=
0
,
size
=
10
):
def
contrast_similar
(
user_id
,
offset
=
0
,
size
=
10
):
try
:
try
:
if
isinstance
(
user_id
,
int
):
if
isinstance
(
user_id
,
int
):
...
@@ -59,18 +59,22 @@ def get_all_topic_id_list(user_id, offset, size):
...
@@ -59,18 +59,22 @@ def get_all_topic_id_list(user_id, offset, size):
"term"
:
{
"term"
:
{
"is_deleted"
:
False
"is_deleted"
:
False
}
}
}],
},
{
"terms"
:{
"content_level"
:[
3
,
4
,
5
]
}
}],
"minimum_should_match"
:
1
,
"should"
:
{
"should"
:
{
"
match
"
:
{
"
terms
"
:
{
"
participant_
user_id"
:
read_topic_id_list
"user_id"
:
read_topic_id_list
}
}
},
}
"minimum_should_match"
:
1
}
}
}
}
}
}
}
}
}
}
...
@@ -82,9 +86,9 @@ def get_all_topic_id_list(user_id, offset, size):
...
@@ -82,9 +86,9 @@ def get_all_topic_id_list(user_id, offset, size):
offset
=
offset
,
size
=
size
)
offset
=
offset
,
size
=
size
)
contrast_topic_ids
=
[]
contrast_topic_ids
=
[]
if
result_dict
[
'hits'
][
"total"
]
>
0
:
if
len
(
result_dict
[
'hits'
])
>
0
:
res_hit
=
result_dict
[
'hits'
]
[
"hits"
]
res_hit
=
result_dict
[
'hits'
]
for
item
in
res_hit
:
for
item
in
res_hit
:
topic_id
=
item
[
'_source'
][
'id'
]
topic_id
=
item
[
'_source'
][
'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