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
b7298dfb
Commit
b7298dfb
authored
Dec 09, 2020
by
Terri Chu
Committed by
Dylan Griffith
Dec 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch Search Elasticsearch index to use default english stemmer
parent
0860559f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
31 deletions
+27
-31
ee/changelogs/unreleased/277390-global-search-not-finding-result-when-project-search-does.yml
...al-search-not-finding-result-when-project-search-does.yml
+5
-0
ee/lib/elastic/latest/config.rb
ee/lib/elastic/latest/config.rb
+1
-5
ee/spec/lib/gitlab/elastic/search_results_spec.rb
ee/spec/lib/gitlab/elastic/search_results_spec.rb
+21
-26
No files found.
ee/changelogs/unreleased/277390-global-search-not-finding-result-when-project-search-does.yml
0 → 100644
View file @
b7298dfb
---
title
:
Switch Search Elasticsearch index to use english stemmer
merge_request
:
48518
author
:
type
:
fixed
ee/lib/elastic/latest/config.rb
View file @
b7298dfb
...
...
@@ -39,7 +39,7 @@ module Elastic
analyzer:
{
default:
{
tokenizer:
'standard'
,
filter:
%w(lowercase
my_
stemmer)
filter:
%w(lowercase stemmer)
},
my_ngram_analyzer:
{
tokenizer:
'my_ngram_tokenizer'
,
...
...
@@ -62,10 +62,6 @@ module Elastic
}
},
filter:
{
my_stemmer:
{
type:
'stemmer'
,
name:
'light_english'
},
code:
{
type:
"pattern_capture"
,
preserve_original:
true
,
...
...
ee/spec/lib/gitlab/elastic/search_results_spec.rb
View file @
b7298dfb
...
...
@@ -204,28 +204,11 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
describe
'issues'
do
let
(
:scope
)
{
'issues'
}
let!
(
:issue_1
)
{
create
(
:issue
,
project:
project_1
,
title:
'Hello world, here I am!'
,
iid:
1
)
}
let!
(
:issue_2
)
{
create
(
:issue
,
project:
project_1
,
title:
'Issue Two'
,
description:
'Hello world, here I am!'
,
iid:
2
)
}
let!
(
:issue_3
)
{
create
(
:issue
,
project:
project_2
,
title:
'Issue Three'
,
iid:
2
)
}
before
do
@issue_1
=
create
(
:issue
,
project:
project_1
,
title:
'Hello world, here I am!'
,
iid:
1
)
@issue_2
=
create
(
:issue
,
project:
project_1
,
title:
'Issue Two'
,
description:
'Hello world, here I am!'
,
iid:
2
)
@issue_3
=
create
(
:issue
,
project:
project_2
,
title:
'Issue Three'
,
iid:
2
)
ensure_elasticsearch_index!
end
...
...
@@ -235,7 +218,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
results
=
described_class
.
new
(
user
,
'hello world'
,
limit_project_ids
)
issues
=
results
.
objects
(
'issues'
)
expect
(
issues
).
to
contain_exactly
(
@issue_1
,
@
issue_2
)
expect
(
issues
).
to
contain_exactly
(
issue_1
,
issue_2
)
expect
(
results
.
issues_count
).
to
eq
2
end
...
...
@@ -250,7 +233,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
results
=
described_class
.
new
(
user
,
'#2'
,
limit_project_ids
,
public_and_internal_projects:
false
)
issues
=
results
.
objects
(
'issues'
)
expect
(
issues
).
to
contain_exactly
(
@
issue_2
)
expect
(
issues
).
to
contain_exactly
(
issue_2
)
expect
(
results
.
issues_count
).
to
eq
1
end
...
...
@@ -258,7 +241,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
results
=
described_class
.
new
(
user
,
'2'
,
limit_project_ids
,
public_and_internal_projects:
false
)
issues
=
results
.
objects
(
'issues'
)
expect
(
issues
).
to
contain_exactly
(
@
issue_2
)
expect
(
issues
).
to
contain_exactly
(
issue_2
)
expect
(
results
.
issues_count
).
to
eq
1
end
...
...
@@ -269,6 +252,18 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
expect
(
results
.
issues_count
).
to
eq
0
end
it
'handles plural words through algorithmic stemming'
,
:aggregate_failures
do
issue1
=
create
(
:issue
,
project:
project_1
,
title:
'remove :title attribute from submit buttons to prevent un-styled tooltips'
)
issue2
=
create
(
:issue
,
project:
project_1
,
title:
'smarter submit behavior for buttons groups'
)
ensure_elasticsearch_index!
results
=
described_class
.
new
(
user
,
'button'
,
limit_project_ids
)
expect
(
results
.
objects
(
'issues'
)).
to
contain_exactly
(
issue1
,
issue2
)
expect
(
results
.
issues_count
).
to
eq
2
end
context
'filtering'
do
let!
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:closed_result
)
{
create
(
:issue
,
:closed
,
project:
project
,
title:
'foo closed'
)
}
...
...
@@ -990,7 +985,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
commits
=
results
.
objects
(
'commits'
)
expect
(
commits
.
first
.
message
.
downcase
).
to
include
(
"add"
)
expect
(
results
.
commits_count
).
to
eq
2
4
expect
(
results
.
commits_count
).
to
eq
2
1
end
it
'finds commits from public projects only'
do
...
...
@@ -1000,10 +995,10 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
ensure_elasticsearch_index!
results
=
described_class
.
new
(
user
,
'add'
,
[
project_1
.
id
])
expect
(
results
.
commits_count
).
to
eq
2
4
expect
(
results
.
commits_count
).
to
eq
2
1
results
=
described_class
.
new
(
user
,
'add'
,
[
project_1
.
id
,
project_2
.
id
])
expect
(
results
.
commits_count
).
to
eq
4
8
expect
(
results
.
commits_count
).
to
eq
4
2
end
it
'returns zero when commits are not found'
do
...
...
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