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
d7d37ab9
Commit
d7d37ab9
authored
5 years ago
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'branch_suggester' into 'master'
Branch suggester See merge request
!348
parents
4478c850
d63491e5
master
deploy/like-prod
deploy/like-stage
deploy/like-test
dev
like-pre/r01
test
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
1 deletion
+46
-1
tag.py
search/views/tag.py
+2
-0
tag.json
trans2es/mapping/tag.json
+2
-0
tag_v1.json
trans2es/mapping/tag_v1.json
+31
-0
type_info.py
trans2es/type_info.py
+10
-0
tag_transfer.py
trans2es/utils/tag_transfer.py
+1
-1
No files found.
search/views/tag.py
View file @
d7d37ab9
...
@@ -27,6 +27,8 @@ def get_highlight(fields=[]):
...
@@ -27,6 +27,8 @@ def get_highlight(fields=[]):
@bind
(
"physical/search/query_tag"
)
@bind
(
"physical/search/query_tag"
)
def
query_tag
(
query
,
offset
,
size
):
def
query_tag
(
query
,
offset
,
size
):
try
:
try
:
if
query
:
query
=
query
.
lower
()
q
=
{
q
=
{
"suggest"
:{
"suggest"
:{
"tips-suggest"
:{
"tips-suggest"
:{
...
...
This diff is collapsed.
Click to expand it.
trans2es/mapping/tag.json
View file @
d7d37ab9
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
"properties"
:
{
"properties"
:
{
"id"
:{
"type"
:
"long"
},
"id"
:{
"type"
:
"long"
},
"suggest"
:{
"suggest"
:{
"analyzer"
:
"keyword"
,
"search_analyzer"
:
"keyword"
,
"type"
:
"completion"
,
"type"
:
"completion"
,
"contexts"
:[
"contexts"
:[
{
{
...
...
This diff is collapsed.
Click to expand it.
trans2es/mapping/tag_v1.json
0 → 100644
View file @
d7d37ab9
{
"dynamic"
:
"strict"
,
"properties"
:
{
"id"
:{
"type"
:
"long"
},
"suggest"
:{
"analyzer"
:
"keyword"
,
"search_analyzer"
:
"keyword"
,
"type"
:
"completion"
,
"contexts"
:[
{
"name"
:
"is_online"
,
"type"
:
"category"
,
"path"
:
"is_online"
},
{
"name"
:
"is_deleted"
,
"type"
:
"category"
,
"path"
:
"is_deleted"
}
]
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"tag_type"
:{
"type"
:
"long"
},
"collection"
:{
"type"
:
"long"
},
"is_ai"
:{
"type"
:
"long"
},
"is_own"
:{
"type"
:
"long"
},
"is_online"
:{
"type"
:
"keyword"
},
//上线
"is_deleted"
:{
"type"
:
"keyword"
},
"near_new_topic_num"
:{
"type"
:
"long"
,
"store"
:
true
}
}
}
This diff is collapsed.
Click to expand it.
trans2es/type_info.py
View file @
d7d37ab9
...
@@ -466,6 +466,16 @@ def get_type_info_map():
...
@@ -466,6 +466,16 @@ def get_type_info_map():
round_insert_chunk_size
=
5
,
round_insert_chunk_size
=
5
,
round_insert_period
=
2
,
round_insert_period
=
2
,
),
),
TypeInfo
(
name
=
"tag_v1"
,
# 标签
type
=
"tag_v1"
,
model
=
tag
.
Tag
,
query_deferred
=
lambda
:
tag
.
Tag
.
objects
.
all
()
.
query
,
get_data_func
=
TagTransfer
.
get_tag_data
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_period
=
2
,
),
TypeInfo
(
TypeInfo
(
name
=
"tag-name"
,
# 标签名字
name
=
"tag-name"
,
# 标签名字
type
=
"tag-name"
,
type
=
"tag-name"
,
...
...
This diff is collapsed.
Click to expand it.
trans2es/utils/tag_transfer.py
View file @
d7d37ab9
...
@@ -39,7 +39,7 @@ class TagTransfer(object):
...
@@ -39,7 +39,7 @@ class TagTransfer(object):
for
j
in
range
(
i
,
len
(
instance
.
name
)
+
1
):
for
j
in
range
(
i
,
len
(
instance
.
name
)
+
1
):
name_term
=
instance
.
name
[
i
:
j
]
.
strip
()
name_term
=
instance
.
name
[
i
:
j
]
.
strip
()
if
name_term
:
if
name_term
:
tag_name_terms_list
.
append
(
name_term
)
tag_name_terms_list
.
append
(
name_term
.
lower
()
)
res
[
"suggest"
]
=
{
res
[
"suggest"
]
=
{
"input"
:
tag_name_terms_list
,
"input"
:
tag_name_terms_list
,
...
...
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