Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-03-12 11:13:21 +0300
committerSean McGivern <sean@gitlab.com>2019-03-13 13:54:43 +0300
commiteba5672077f5d7956fc8f7db583136b3ccb451b5 (patch)
tree59dacd4c67a6909e5abdbc364bcd7c5e0ebfba2b /spec/finders/labels_finder_spec.rb
parentf859b0e1e7f257a962866c98eca430c1338b7dba (diff)
Allow filtering labels by a single character
When we use Gitlab::SQL::Pattern, this typically relates to a trigram index. As the 'tri' indicates, we need at least three characters to be able to use that index. Labels don't have a trigram index, because we never allow you to search for them globally: it's always in the context of a project or a group. In that context, it's just as fast to search for a single character (in general) because there is already a pretty specific index being used.
Diffstat (limited to 'spec/finders/labels_finder_spec.rb')
-rw-r--r--spec/finders/labels_finder_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/finders/labels_finder_spec.rb b/spec/finders/labels_finder_spec.rb
index 9abc52aa664..3f060ba0553 100644
--- a/spec/finders/labels_finder_spec.rb
+++ b/spec/finders/labels_finder_spec.rb
@@ -209,6 +209,12 @@ describe LabelsFinder do
expect(finder.execute).to eq [project_label_1]
end
+
+ it 'returns labels matching a single character' do
+ finder = described_class.new(user, search: '(')
+
+ expect(finder.execute).to eq [group_label_1]
+ end
end
context 'filter by subscription' do