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
80313d23
Commit
80313d23
authored
Feb 13, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
modify See merge request
!10
parents
a34b8908
80561432
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
auto_tips.py
search/utils/auto_tips.py
+1
-1
commons.py
trans2es/commons/commons.py
+5
-5
type_info.py
trans2es/type_info.py
+3
-0
No files found.
search/utils/auto_tips.py
View file @
80313d23
...
@@ -33,7 +33,7 @@ def get_suggest_tips(query,lat,lng,offset=0,size=50):
...
@@ -33,7 +33,7 @@ def get_suggest_tips(query,lat,lng,offset=0,size=50):
}
}
},
},
"_source"
:
{
"_source"
:
{
"include"
:
[
"id"
,
"ori_name"
,
"offline_score"
,
"is_online"
,
"type_flag"
,
"results_num"
]
"include
s
"
:
[
"id"
,
"ori_name"
,
"offline_score"
,
"is_online"
,
"type_flag"
,
"results_num"
]
}
}
}
}
...
...
trans2es/commons/commons.py
View file @
80313d23
...
@@ -21,8 +21,9 @@ def uuid4():
...
@@ -21,8 +21,9 @@ def uuid4():
def
get_tips_suggest_list
(
instance_cn_name
):
def
get_tips_suggest_list
(
instance_cn_name
):
try
:
try
:
ch_full_weight
=
6.0
*
1000
#ch_full_weight = 6.0 * 1000
py_full_weight
=
3.0
*
1000
#py_full_weight = 3.0 * 1000
full_weight
=
3.0
*
1000
py_acronym_full_weight
=
3.0
*
1000
py_acronym_full_weight
=
3.0
*
1000
py_acronym_prefix_weight
=
2
py_acronym_prefix_weight
=
2
...
@@ -42,7 +43,7 @@ def get_tips_suggest_list(instance_cn_name):
...
@@ -42,7 +43,7 @@ def get_tips_suggest_list(instance_cn_name):
for
i
in
range
(
len
(
ch_full_word
)):
for
i
in
range
(
len
(
ch_full_word
)):
ch_name_term
=
ch_full_word
[
i
:]
.
strip
()
ch_name_term
=
ch_full_word
[
i
:]
.
strip
()
if
ch_name_term
and
ch_full_word
[
i
]
!=
"("
and
ch_full_word
[
i
]
!=
")"
:
if
ch_name_term
and
ch_full_word
[
i
]
!=
"("
and
ch_full_word
[
i
]
!=
")"
:
prefix_weight
=
ch_prefix_weight
if
len
(
ch_name_term
)
!=
len
(
ch_full_word
)
else
ch_
full_weight
prefix_weight
=
ch_prefix_weight
if
len
(
ch_name_term
)
!=
len
(
ch_full_word
)
else
full_weight
suggest_type
=
0
if
len
(
ch_name_term
)
!=
len
(
ch_full_word
)
else
1
suggest_type
=
0
if
len
(
ch_name_term
)
!=
len
(
ch_full_word
)
else
1
term_begin_prefix_weight
=
begin_prefix_weight
if
i
==
0
else
1.0
term_begin_prefix_weight
=
begin_prefix_weight
if
i
==
0
else
1.0
suggest_item
=
{
suggest_item
=
{
...
@@ -64,8 +65,7 @@ def get_tips_suggest_list(instance_cn_name):
...
@@ -64,8 +65,7 @@ def get_tips_suggest_list(instance_cn_name):
for
i
in
range
(
len
(
py_full_word
)):
for
i
in
range
(
len
(
py_full_word
)):
py_name_term
=
py_full_word
[
i
:]
.
strip
()
py_name_term
=
py_full_word
[
i
:]
.
strip
()
if
py_name_term
and
py_full_word
[
i
]
!=
"("
and
py_full_word
[
i
]
!=
")"
:
if
py_name_term
and
py_full_word
[
i
]
!=
"("
and
py_full_word
[
i
]
!=
")"
:
prefix_weight
=
py_prefix_weight
if
len
(
py_name_term
)
!=
len
(
prefix_weight
=
py_prefix_weight
if
len
(
py_name_term
)
!=
len
(
py_full_word
)
else
full_weight
py_full_word
)
else
py_full_weight
suggest_type
=
2
if
len
(
py_name_term
)
!=
len
(
py_full_word
)
else
3
suggest_type
=
2
if
len
(
py_name_term
)
!=
len
(
py_full_word
)
else
3
term_begin_prefix_weight
=
begin_prefix_weight
if
i
==
0
else
1.0
term_begin_prefix_weight
=
begin_prefix_weight
if
i
==
0
else
1.0
suggest_item
=
{
suggest_item
=
{
...
...
trans2es/type_info.py
View file @
80313d23
...
@@ -24,6 +24,8 @@ from trans2es.utils.tag_transfer import TagTransfer
...
@@ -24,6 +24,8 @@ from trans2es.utils.tag_transfer import TagTransfer
from
trans2es.utils.wordresemble
import
WordResemble
from
trans2es.utils.wordresemble
import
WordResemble
from
libs.es
import
ESPerform
from
libs.es
import
ESPerform
from
libs.tools
import
tzlc
,
getMd5Digest
from
libs.tools
import
tzlc
,
getMd5Digest
from
trans2es.commons.words_utils
import
QueryWordAttr
from
gm_types.gaia
import
SERVICE_ITEM_PRICE_TYPE
,
DOCTOR_TYPE
from
gm_types.gaia
import
SERVICE_ITEM_PRICE_TYPE
,
DOCTOR_TYPE
from
gm_types.gaia
import
(
from
gm_types.gaia
import
(
...
@@ -155,6 +157,7 @@ class TypeInfo(object):
...
@@ -155,6 +157,7 @@ class TypeInfo(object):
resemble_dict
=
copy
.
deepcopy
(
suggest_dict
)
resemble_dict
=
copy
.
deepcopy
(
suggest_dict
)
resemble_dict
[
"id"
]
=
suggest_dict
[
"id"
]
+
"_"
+
getMd5Digest
(
resemble_item
)
resemble_dict
[
"id"
]
=
suggest_dict
[
"id"
]
+
"_"
+
getMd5Digest
(
resemble_item
)
resemble_dict
[
"ori_name"
]
=
resemble_item
resemble_dict
[
"ori_name"
]
=
resemble_item
resemble_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
resemble_item
)
resemble_dict
[
"offline_score"
]
=
0
resemble_dict
[
"offline_score"
]
=
0
resemble_dict
[
"suggest"
][
"weight"
]
=
0
resemble_dict
[
"suggest"
][
"weight"
]
=
0
data_list
.
append
(
resemble_dict
)
data_list
.
append
(
resemble_dict
)
...
...
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