Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
custom-apps
web-app
Commits
430586c9
Commit
430586c9
authored
6 years ago
by
Alessandro Cerioni
Browse files
Options
Downloads
Patches
Plain Diff
Improved phrase suggestion.
parent
68c021e7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/geosource/services/elasticsearch.service.ts
+11
-7
11 additions, 7 deletions
src/app/geosource/services/elasticsearch.service.ts
src/environments/environment.ts
+1
-1
1 addition, 1 deletion
src/environments/environment.ts
with
12 additions
and
8 deletions
src/app/geosource/services/elasticsearch.service.ts
+
11
−
7
View file @
430586c9
...
@@ -283,8 +283,8 @@ export class ElasticsearchService {
...
@@ -283,8 +283,8 @@ export class ElasticsearchService {
}
}
/*
/*
* This request will get one suggestion
from
the query text
* This request will get one
phrase
suggestion
out of
the query text
*
The suggest is based on metadata-fr.title property
*
cf. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-phrase.html
*/
*/
getSuggestion
(
query
:
string
):
Observable
<
SearchSuggestion
>
{
getSuggestion
(
query
:
string
):
Observable
<
SearchSuggestion
>
{
return
this
.
_http
.
request
<
IElasticsearchResponse
>
(
'
POST
'
,
this
.
url
,
{
return
this
.
_http
.
request
<
IElasticsearchResponse
>
(
'
POST
'
,
this
.
url
,
{
...
@@ -293,16 +293,20 @@ export class ElasticsearchService {
...
@@ -293,16 +293,20 @@ export class ElasticsearchService {
text
:
query
,
text
:
query
,
suggestion
:
{
suggestion
:
{
phrase
:
{
phrase
:
{
field
:
'
data_and_metadata
'
,
field
:
'
data_and_metadata.suggest
'
,
// as only the very first suggestion will be used, let's limit the size of the results to 1:
size
:
1
,
max_errors
:
query
.
split
(
'
'
).
length
,
highlight
:
{
highlight
:
{
pre_tag
:
'
<b><i>
'
,
pre_tag
:
'
<b><i>
'
,
post_tag
:
'
</i></b>
'
,
post_tag
:
'
</i></b>
'
,
},
},
analyzer
:
'
my_search_analyzer
'
,
direct_generator
:
[{
direct_generator
:
[{
field
:
'
data_and_metadata
'
,
field
:
'
data_and_metadata
.suggest
'
,
suggest_mode
:
'
popular
'
,
suggest_mode
:
'
missing
'
,
//
prefix_length:
4
,
prefix_length
:
1
,
min_word_length
:
1
,
min_word_length
:
4
,
}],
}],
},
},
},
},
...
...
This diff is collapsed.
Click to expand it.
src/environments/environment.ts
+
1
−
1
View file @
430586c9
...
@@ -11,7 +11,7 @@ export const environment = {
...
@@ -11,7 +11,7 @@ export const environment = {
// ElasticSearch
// ElasticSearch
elasticsearchUrl
:
{
elasticsearchUrl
:
{
full
:
servicesProxyUrl
+
'
/elasticsearch2/test-all-in-one-index.full.v
8
.quadtree
'
,
full
:
servicesProxyUrl
+
'
/elasticsearch2/test-all-in-one-index.full.v
9
.quadtree
'
,
meta
:
servicesProxyUrl
+
'
/elasticsearch/*.meta
'
,
meta
:
servicesProxyUrl
+
'
/elasticsearch/*.meta
'
,
},
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment