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
463fc036
Commit
463fc036
authored
Dec 19, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
91f5a2c5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
tag.json
trans2es/mapping/tag.json
+8
-0
type_info.py
trans2es/type_info.py
+12
-1
group_transfer.py
trans2es/utils/group_transfer.py
+2
-2
tag_transfer.py
trans2es/utils/tag_transfer.py
+23
-0
No files found.
trans2es/mapping/tag.json
0 → 100644
View file @
463fc036
{
"dynamic"
:
"strict"
,
"properties"
:
{
"suggest"
:{
"type"
:
"completion"
},
"name"
:{
"type"
:
"text"
}
//上线
}
}
\ No newline at end of file
trans2es/type_info.py
View file @
463fc036
...
...
@@ -12,12 +12,13 @@ import elasticsearch
import
elasticsearch.helpers
import
sys
from
trans2es.models
import
topic
,
user
,
pick_celebrity
,
group
,
celebrity
from
trans2es.models
import
topic
,
user
,
pick_celebrity
,
group
,
celebrity
,
tag
from
trans2es.utils.user_transfer
import
UserTransfer
from
trans2es.utils.pick_celebrity_transfer
import
PickCelebrityTransfer
from
trans2es.utils.group_transfer
import
GroupTransfer
from
trans2es.utils.topic_transfer
import
TopicTransfer
from
trans2es.utils.celebrity_transfer
import
CelebrityTransfer
from
trans2es.utils.tag_transfer
import
TagTransfer
from
libs.es
import
ESPerform
__es
=
None
...
...
@@ -286,6 +287,16 @@ def get_type_info_map():
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
round_insert_period
=
2
,
),
TypeInfo
(
name
=
"tag"
,
# 标签
type
=
"tag"
,
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
,
)
]
...
...
trans2es/utils/group_transfer.py
View file @
463fc036
...
...
@@ -38,4 +38,4 @@ class GroupTransfer(object):
return
res
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
None
\ No newline at end of file
return
dict
()
\ No newline at end of file
trans2es/utils/tag_transfer.py
0 → 100644
View file @
463fc036
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
os
import
sys
import
logging
import
traceback
from
libs.tools
import
tzlc
class
TagTransfer
(
object
):
@classmethod
def
get_tag_data
(
cls
,
instance
):
try
:
res
=
dict
()
res
[
"suggest"
]
=
instance
.
name
res
[
"name"
]
=
instance
.
name
return
res
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
dict
()
\ No newline at end of file
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