Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2f89f43f
Commit
2f89f43f
authored
Sep 11, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Elasticsearch does not find partial matches in project names
parent
1b0e045d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
7 deletions
+35
-7
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/models/concerns/elastic/application_search.rb
app/models/concerns/elastic/application_search.rb
+16
-4
app/models/concerns/elastic/projects_search.rb
app/models/concerns/elastic/projects_search.rb
+2
-1
lib/tasks/gitlab/elastic.rake
lib/tasks/gitlab/elastic.rake
+1
-1
spec/models/concerns/elastic/project_spec.rb
spec/models/concerns/elastic/project_spec.rb
+15
-1
No files found.
CHANGELOG-EE
View file @
2f89f43f
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (Unreleased)
- [ES] Instrument Elasticsearch::Git::Repository
- [ES] Instrument other Gitlab::Elastic classes
- [ES] Fix: Elasticsearch does not find partial matches in project names
v 8.11.6
- Exclude blocked users from potential MR approvers
...
...
app/models/concerns/elastic/application_search.rb
View file @
2f89f43f
...
...
@@ -13,14 +13,26 @@ module Elastic
analysis:
{
analyzer:
{
default:
{
tokenizer:
"standard"
,
filter:
[
"standard"
,
"lowercase"
,
"my_stemmer"
]
tokenizer:
'standard'
,
filter:
[
'standard'
,
'lowercase'
,
'my_stemmer'
]
},
my_ngram_analyzer:
{
tokenizer:
'my_ngram_tokenizer'
,
filter:
[
'lowercase'
]
}
},
filter:
{
my_stemmer:
{
type:
"stemmer"
,
name:
"light_english"
type:
'stemmer'
,
name:
'light_english'
}
},
tokenizer:
{
my_ngram_tokenizer:
{
type:
'nGram'
,
min_gram:
2
,
max_gram:
3
,
token_chars:
[
'letter'
,
'digit'
]
}
}
}
...
...
app/models/concerns/elastic/projects_search.rb
View file @
2f89f43f
...
...
@@ -12,7 +12,8 @@ module Elastic
indexes
:path
,
type: :string
,
index_options:
'offsets'
indexes
:name_with_namespace
,
type: :string
,
index_options:
'offsets'
index_options:
'offsets'
,
analyzer: :my_ngram_analyzer
indexes
:path_with_namespace
,
type: :string
,
index_options:
'offsets'
indexes
:description
,
type: :string
,
...
...
lib/tasks/gitlab/elastic.rake
View file @
2f89f43f
...
...
@@ -58,7 +58,7 @@ namespace :gitlab do
desc
"GitLab | Elasticsearch | Index wiki repositories"
task
index_wikis: :environment
do
projects
=
apply_project_filters
(
Project
.
w
here
(
wiki_enabled:
true
)
)
projects
=
apply_project_filters
(
Project
.
w
ith_wiki_enabled
)
projects
.
find_each
do
|
project
|
unless
project
.
wiki
.
empty?
...
...
spec/models/concerns/elastic/project_spec.rb
View file @
2f89f43f
...
...
@@ -11,7 +11,7 @@ describe Project, elastic: true do
stub_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
it
"
searche
s projects"
do
it
"
find
s projects"
do
project_ids
=
[]
Sidekiq
::
Testing
.
inline!
do
...
...
@@ -29,6 +29,20 @@ describe Project, elastic: true do
expect
(
described_class
.
elastic_search
(
'someone_elses_project'
,
options:
{
pids:
project_ids
}).
total_count
).
to
eq
(
0
)
end
it
"finds partial matches in project names"
do
project_ids
=
[]
Sidekiq
::
Testing
.
inline!
do
project
=
create
:empty_project
,
name:
'tesla-model-s'
project1
=
create
:empty_project
,
name:
'tesla_model_s'
project_ids
+=
[
project
.
id
,
project1
.
id
]
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
expect
(
described_class
.
elastic_search
(
'tesla'
,
options:
{
pids:
project_ids
}).
total_count
).
to
eq
(
2
)
end
it
"returns json with all needed elements"
do
project
=
create
:empty_project
...
...
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