Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
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
rank
search_tips
Commits
d999f823
Commit
d999f823
authored
Jun 26, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增新标签的联想词
parent
213d6a70
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
15 deletions
+23
-15
associate_trans2es_mapping2es.py
...iate/management/commands/associate_trans2es_mapping2es.py
+1
-0
associate_trans2es_tipsdata2es.py
...ate/management/commands/associate_trans2es_tipsdata2es.py
+0
-0
agile_tag.py
associate/models/agile_tag.py
+9
-9
type_info.py
associate/type_info.py
+4
-4
es.py
libs/es.py
+7
-1
settings.py
search_tips/settings.py
+2
-1
No files found.
associate/management/commands/associate_trans2es_mapping2es.py
View file @
d999f823
...
...
@@ -47,6 +47,7 @@ class Command(BaseCommand):
ESPerform
.
create_index
(
es_cli
,
type_name
)
logging
.
info
(
"begin create [
%
s] mapping!"
%
type_name
)
ESPerform
.
put_index_mapping
(
es_cli
,
type_name
)
if
len
(
options
[
"indices_template"
]):
...
...
associate/management/commands/trans2es_tipsdata2es.py
→
associate/management/commands/
associate_
trans2es_tipsdata2es.py
View file @
d999f823
File moved
associate/models/agile_tag.py
View file @
d999f823
...
...
@@ -6,12 +6,12 @@ import logging
import
traceback
import
base64
from
django.db
import
models
from
gm_types.gaia
import
(
AGILE_TAG_TYPE
,
AGILE_TAG_CREATE_TYPE
,
AGILE_TAG_STYLE
,
AGILE_TAG_RECOMMEND_TYPE
,
)
#
from gm_types.gaia import (
#
AGILE_TAG_TYPE,
#
AGILE_TAG_CREATE_TYPE,
#
AGILE_TAG_STYLE,
#
AGILE_TAG_RECOMMEND_TYPE,
#
)
class
BaseModel
(
models
.
Model
):
...
...
@@ -31,8 +31,8 @@ class AgileTag(BaseModel):
name
=
models
.
CharField
(
verbose_name
=
u'新标签名字'
,
max_length
=
128
,
null
=
False
,
unique
=
True
,
default
=
''
)
description
=
models
.
TextField
(
verbose_name
=
u'描述'
,
default
=
''
)
create_tag_type
=
models
.
CharField
(
verbose_name
=
u"标签创建类型"
,
max_length
=
3
,
choices
=
AGILE_TAG_CREATE_TYPE
)
style
=
models
.
CharField
(
verbose_name
=
u"标签样式"
,
max_length
=
3
,
choices
=
AGILE_TAG_STYLE
)
create_tag_type
=
models
.
CharField
(
verbose_name
=
u"标签创建类型"
,
max_length
=
3
,
choices
=
1
)
style
=
models
.
CharField
(
verbose_name
=
u"标签样式"
,
max_length
=
3
,
choices
=
1
)
topic_recommend_sort
=
models
.
IntegerField
(
verbose_name
=
u'帖子推荐排序'
,
default
=
9999
)
...
...
@@ -43,7 +43,7 @@ class AgileTagType(BaseModel):
app_label
=
'api'
agile_tag_id
=
models
.
IntegerField
(
verbose_name
=
u'新标签'
,
db_index
=
True
)
agile_tag_type
=
models
.
CharField
(
verbose_name
=
u"标签类型"
,
max_length
=
3
,
choices
=
AGILE_TAG_TYPE
)
agile_tag_type
=
models
.
CharField
(
verbose_name
=
u"标签类型"
,
max_length
=
3
,
choices
=
1
)
@property
def
get_by_id_name
(
self
):
...
...
associate/type_info.py
View file @
d999f823
...
...
@@ -9,10 +9,10 @@ import django.db.models
import
copy
from
libs.es
import
ESPerform
from
associate.models
import
agile_tag
from
associate.utils
import
TagTransfer
from
gm_types.gaia
import
(
AGILE_TAG_TYPE
,
)
from
associate.utils
.agile_tag_transfer
import
TagTransfer
#
from gm_types.gaia import (
#
AGILE_TAG_TYPE,
#
)
__es
=
None
...
...
libs/es.py
View file @
d999f823
...
...
@@ -53,9 +53,15 @@ class ESPerform(object):
@classmethod
def
__load_mapping
(
cls
,
doc_type
):
try
:
mapping_file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'trans2es'
,
'mapping'
,
'
%
s.json'
%
(
doc_type
,))
if
doc_type
==
"associate_tag"
:
mapping_file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'associate'
,
'mapping'
,
'
%
s.json'
%
(
doc_type
,))
mapping
=
''
with
open
(
mapping_file_path
,
'r'
)
as
f
:
for
line
in
f
:
...
...
@@ -141,7 +147,7 @@ class ESPerform(object):
try
:
assert
(
es_cli
is
not
None
)
official_index_name
=
cls
.
get_official_index_name
(
sub_index_name
,
"write"
)
official_index_name
=
cls
.
get_official_index_name
(
sub_index_name
,
"write"
)
index_exists
=
es_cli
.
indices
.
exists
(
official_index_name
)
if
not
index_exists
:
if
not
auto_create_index
:
...
...
search_tips/settings.py
View file @
d999f823
...
...
@@ -61,7 +61,8 @@ INSTALLED_APPS = [
'django.contrib.staticfiles'
,
'trans2es'
,
'search'
,
'injection.data_sync'
'injection.data_sync'
,
"associate"
]
MIDDLEWARE
=
[
...
...
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