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
d3c8f609
Commit
d3c8f609
authored
Dec 12, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
modify See merge request
!14
parents
817c8262
074d6891
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
16 deletions
+26
-16
topic.py
search/utils/topic.py
+26
-16
No files found.
search/utils/topic.py
View file @
d3c8f609
...
@@ -140,30 +140,40 @@ class TopicUtils(object):
...
@@ -140,30 +140,40 @@ class TopicUtils(object):
q
[
"query"
]
=
dict
()
q
[
"query"
]
=
dict
()
functions_list
=
[
functions_list
=
[
{
"gauss"
:
{
"update_time"
:
{
"scale"
:
"1d"
,
"decay"
:
0.5
}
}
}
]
if
len
(
attention_user_id_term_list
)
>
0
:
functions_list
.
append
(
{
{
"filter"
:
{
"bool"
:
{
"filter"
:
{
"bool"
:
{
"should"
:
attention_user_id_term_list
}},
"should"
:
attention_user_id_term_list
}},
"weight"
:
5
,
"weight"
:
3
,
},
}
)
elif
len
(
pick_user_id_term_list
)
>
0
:
functions_list
.
append
(
{
{
"filter"
:
{
"bool"
:
{
"filter"
:
{
"bool"
:
{
"should"
:
pick_user_id_term_list
}},
"should"
:
pick_user_id_term_list
}},
"weight"
:
3
"weight"
:
2
},
}
)
elif
len
(
same_group_user_id_term_list
)
>
0
:
functions_list
.
append
(
{
{
"filter"
:
{
"bool"
:
{
"filter"
:
{
"bool"
:
{
"should"
:
same_group_user_id_term_list
}},
"should"
:
same_group_user_id_term_list
}},
"weight"
:
2
"weight"
:
1
},
{
"gauss"
:
{
"update_time"
:
{
"scale"
:
"1d"
,
"decay"
:
0.5
}
}
}
}
]
)
query_tag_term_list
=
cls
.
___get_should_term_list
(
user_tag_list
)
query_tag_term_list
=
cls
.
___get_should_term_list
(
user_tag_list
)
query_function_score
=
{
query_function_score
=
{
...
@@ -175,8 +185,8 @@ class TopicUtils(object):
...
@@ -175,8 +185,8 @@ class TopicUtils(object):
}
}
}
}
},
},
"score_mode"
:
"
max
"
,
"score_mode"
:
"
sum
"
,
"boost_mode"
:
"
replace
"
,
"boost_mode"
:
"
sum
"
,
"functions"
:
functions_list
"functions"
:
functions_list
}
}
...
...
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