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
d63491e5
Commit
d63491e5
authored
May 20, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
1a6e3b5d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
1 deletion
+44
-1
tag.py
search/views/tag.py
+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 @
d63491e5
...
...
@@ -27,6 +27,8 @@ def get_highlight(fields=[]):
@bind
(
"physical/search/query_tag"
)
def
query_tag
(
query
,
offset
,
size
):
try
:
if
query
:
query
=
query
.
lower
()
q
=
{
"suggest"
:{
"tips-suggest"
:{
...
...
trans2es/mapping/tag_v1.json
0 → 100644
View file @
d63491e5
{
"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
}
}
}
trans2es/type_info.py
View file @
d63491e5
...
...
@@ -466,6 +466,16 @@ def get_type_info_map():
round_insert_chunk_size
=
5
,
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
(
name
=
"tag-name"
,
# 标签名字
type
=
"tag-name"
,
...
...
trans2es/utils/tag_transfer.py
View file @
d63491e5
...
...
@@ -39,7 +39,7 @@ class TagTransfer(object):
for
j
in
range
(
i
,
len
(
instance
.
name
)
+
1
):
name_term
=
instance
.
name
[
i
:
j
]
.
strip
()
if
name_term
:
tag_name_terms_list
.
append
(
name_term
)
tag_name_terms_list
.
append
(
name_term
.
lower
()
)
res
[
"suggest"
]
=
{
"input"
:
tag_name_terms_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