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
213d6a70
Commit
213d6a70
authored
Jun 26, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增搜索域
parent
62339c2e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
54 additions
and
49 deletions
+54
-49
app_conf.xml
app_conf.xml
+1
-1
apps.py
associate/apps.py
+1
-1
associate_trans2es_data2es_parallel.py
...anagement/commands/associate_trans2es_data2es_parallel.py
+9
-13
associate_trans2es_mapping2es.py
...iate/management/commands/associate_trans2es_mapping2es.py
+1
-1
trans2es_tipsdata2es.py
associate/management/commands/trans2es_tipsdata2es.py
+3
-12
auto_tips.py
associate/search/views/auto_tips.py
+2
-6
hotword_result.py
associate/search/views/hotword_result.py
+1
-1
type_info.py
associate/type_info.py
+2
-11
agile_tag_transfer.py
associate/utils/agile_tag_transfer.py
+3
-3
develop_server.py
develop_server.py
+31
-0
No files found.
app_conf.xml
View file @
213d6a70
...
...
@@ -10,6 +10,6 @@
<element
value=
"search_tips.django_init"
/>
<element
value=
"search.view.auto_tips"
/>
<element
value=
"associate.search.views.auto_tips"
/>
<element
value=
"associate.search.views.hotword_result
s
"
/>
<element
value=
"associate.search.views.hotword_result"
/>
</config>
</gm_rpcd_config>
associate/apps.py
View file @
213d6a70
...
...
@@ -2,4 +2,4 @@ from django.apps import AppConfig
class
Trans2EsConfig
(
AppConfig
):
name
=
'
trans2es
'
name
=
'
associate
'
associate/management/commands/trans2es_data2es_parallel.py
→
associate/management/commands/
associate_
trans2es_data2es_parallel.py
View file @
213d6a70
...
...
@@ -3,19 +3,15 @@
import
django.db.models
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
import
traceback
import
logging
import
six
import
sys
from
libs.es
import
ESPerform
import
trans2es.models
as
md
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
from
libs.cache
import
redis_client
import
json
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
associate.type_info
import
get_type_info_map
,
TypeInfo
class
Job
(
object
):
...
...
@@ -46,22 +42,22 @@ class Job(object):
)
class
Command
(
BaseCommand
):
args
=
''
help
=
'dump data to elasticsearch, parallel'
from
optparse
import
make_option
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'-t'
,
'--type'
,
dest
=
'type'
,
help
=
'type name to dump data to elasticsearch'
,
metavar
=
'TYPE'
,
default
=
''
),
make_option
(
'-i'
,
'--index-prefix'
,
dest
=
'index_prefix'
,
help
=
'index name to dump data to elasticsearch'
,
metavar
=
'INDEX_PREFIX'
),
make_option
(
'-t'
,
'--type'
,
dest
=
'type'
,
help
=
'type name to dump data to elasticsearch'
,
metavar
=
'TYPE'
,
default
=
''
),
make_option
(
'-i'
,
'--index-prefix'
,
dest
=
'index_prefix'
,
help
=
'index name to dump data to elasticsearch'
,
metavar
=
'INDEX_PREFIX'
),
make_option
(
'-p'
,
'--parallel'
,
dest
=
'parallel'
,
help
=
'parallel process count'
,
metavar
=
'PARALLEL'
),
make_option
(
'-s'
,
'--pks'
,
dest
=
'pks'
,
help
=
'specify sync pks, comma separated'
,
metavar
=
'PKS'
,
default
=
''
),
make_option
(
'--streaming-slicing'
,
dest
=
'streaming_slicing'
,
action
=
'store_true'
,
default
=
True
),
make_option
(
'--no-streaming-slicing'
,
dest
=
'streaming_slicing'
,
action
=
'store_false'
,
default
=
True
),
make_option
(
'-S'
,
'--sync_type'
,
dest
=
'sync_type'
,
help
=
'sync data to es'
,
metavar
=
'TYPE'
,
default
=
''
)
make_option
(
'-S'
,
'--sync_type'
,
dest
=
'sync_type'
,
help
=
'sync data to es'
,
metavar
=
'TYPE'
,
default
=
''
)
)
def
__sync_data_by_type
(
self
,
type_name
):
...
...
@@ -86,7 +82,7 @@ class Command(BaseCommand):
for
type_name
in
type_name_list
:
if
len
(
options
[
"type"
]):
if
options
[
"type"
]
==
"all"
or
type_name
==
options
[
"type"
]:
if
options
[
"type"
]
==
"all"
or
type_name
==
options
[
"type"
]:
logging
.
info
(
"begin sync [
%
s] data to es!"
%
type_name
)
self
.
__sync_data_by_type
(
type_name
)
...
...
associate/management/commands/trans2es_mapping2es.py
→
associate/management/commands/
associate_
trans2es_mapping2es.py
View file @
213d6a70
...
...
@@ -6,7 +6,7 @@ from django.core.management.base import BaseCommand
import
traceback
import
logging
from
libs.es
import
ESPerform
from
trans2es
.type_info
import
get_type_info_map
from
associate
.type_info
import
get_type_info_map
class
Command
(
BaseCommand
):
...
...
associate/management/commands/trans2es_tipsdata2es.py
View file @
213d6a70
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
django.db.models
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
import
traceback
import
logging
import
six
import
sys
from
libs.es
import
ESPerform
import
trans2es.models
as
md
from
libs.table_scan
import
TableSlicer
,
TableSlicerChunk
from
trans2es.type_info
import
get_type_info_map
,
TypeInfo
,
tips_attr_sync_to_redis_type_info_map
from
libs.cache
import
redis_client
import
json
from
libs.table_scan
import
TableSlicer
from
associate.type_info
import
tips_attr_sync_to_redis_type_info_map
class
Command
(
BaseCommand
):
...
...
associate/search/views/auto_tips.py
View file @
213d6a70
...
...
@@ -5,15 +5,11 @@ from __future__ import unicode_literals, absolute_import, print_function
from
gm_rpcd.all
import
bind
import
logging
import
traceback
import
json
from
libs.es
import
ESPerform
from
libs.cache
import
redis_client
from
libs.tools
import
json_http_response
from
associate.search.utils.auto_tips
import
get_suggest_tips
@bind
(
"
associate/search/auto_comple
te_query"
)
def
auto_
comple
te_query
(
query
,
agile_tag_type
=-
1
):
@bind
(
"
search_tips/search/auto_associa
te_query"
)
def
auto_
associa
te_query
(
query
,
agile_tag_type
=-
1
):
try
:
"""auto complate words/tags/doctors etc.
...
...
associate/search/views/hotword_result.py
View file @
213d6a70
...
...
@@ -8,7 +8,7 @@ import traceback
from
associate.commons.words_utils
import
QueryWordAttr
@bind
(
"
associate
/search/tag_hotword_num"
)
@bind
(
"
search_tips
/search/tag_hotword_num"
)
def
get_hotword_num
(
tag_id_list
):
try
:
tag_id_num
=
list
()
...
...
associate/type_info.py
View file @
213d6a70
...
...
@@ -6,21 +6,12 @@ import datetime
import
logging
import
traceback
import
django.db.models
from
django.conf
import
settings
from
libs.es
import
ESPerform
import
elasticsearch
import
elasticsearch.helpers
import
sys
import
copy
from
libs.es
import
ESPerform
from
libs.tools
import
tzlc
,
getMd5Digest
from
trans2es.models
import
agile_tag
from
trans2es.utils.agile_tag_transfer
import
TagTransfer
from
associate.models
import
agile_tag
from
associate.utils
import
TagTransfer
from
gm_types.gaia
import
(
AGILE_TAG_TYPE
,
AGILE_TAG_CREATE_TYPE
,
AGILE_TAG_STYLE
,
AGILE_TAG_RECOMMEND_TYPE
,
)
__es
=
None
...
...
associate/utils/agile_tag_transfer.py
View file @
213d6a70
...
...
@@ -9,10 +9,10 @@ from libs.es import ESPerform
from
libs.cache
import
redis_client
import
json
import
base64
from
trans2es
.models
import
agile_tag
from
trans2es
.commons.commons
import
get_tips_suggest_list
from
associate
.models
import
agile_tag
from
associate
.commons.commons
import
get_tips_suggest_list
from
django.conf
import
settings
from
trans2es
.commons.words_utils
import
QueryWordAttr
from
associate
.commons.words_utils
import
QueryWordAttr
class
TagTransfer
(
object
):
...
...
develop_server.py
0 → 100644
View file @
213d6a70
import
sys
from
gm_rpcd.commands.utils
import
add_cwd_to_path
from
gm_rpcd.internals.utils
import
serve
def
main
(
args
):
add_cwd_to_path
()
from
gm_rpcd.internals.configuration
import
config
config
.
is_develop_mode
=
True
config
.
freeze
()
host
=
'127.0.0.1'
port
=
9000
try
:
first_arg
=
args
[
0
]
except
IndexError
:
pass
else
:
if
':'
in
first_arg
:
host
,
port
=
first_arg
.
split
(
':'
)
port
=
int
(
port
)
else
:
port
=
int
(
first_arg
)
print
(
'Serving on {}:{}'
.
format
(
host
,
port
))
serve
(
host
=
host
,
port
=
port
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
:])
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