Global Search: Add Chinese and Japanese languages support
What does this MR do?
This MR implements support for 2 elasticsearch analysis plugins: smartcn and kuromoji to improve Chinese and Japanese languages support. This is an optional feature and requires plugin(s) installation.
When Searching is enabled, part of the query changes:
before
{
"simple_query_string": {
"_name": "issue:match:search_terms",
"fields": [
"title^2",
"description"
],
"query": "some_query",
"default_operator": "or"
}
}
after
{
"simple_query_string": {
"_name": "issue:match:search_terms",
"fields": [
"title^2",
"description",
"title.smartcn",
"title.kuromoji",
"description.smartcn",
"description.kuromoji"
],
"query": "some_query",
"default_operator": "or"
}
}
We add additional indexed fields for title
and description
to the list of fields
Migrations
Click to see migrations details
db:migrate:up
== 20201019101549 AddEsCustomAnalyzersSettings: migrating =====================
-- add_column(:application_settings, :elasticsearch_analyzers_smartcn_enabled, :bool, {:null=>false, :default=>false})
-> 0.0028s
-- add_column(:application_settings, :elasticsearch_analyzers_smartcn_search, :bool, {:null=>false, :default=>false})
-> 0.0013s
-- add_column(:application_settings, :elasticsearch_analyzers_kuromoji_enabled, :bool, {:null=>false, :default=>false})
-> 0.0010s
-- add_column(:application_settings, :elasticsearch_analyzers_kuromoji_search, :bool, {:null=>false, :default=>false})
-> 0.0010s
== 20201019101549 AddEsCustomAnalyzersSettings: migrated (0.0062s) ============
db:migrate:down
== 20201019101549 AddEsCustomAnalyzersSettings: reverting =====================
-- remove_column(:application_settings, :elasticsearch_analyzers_kuromoji_search, :bool, {:null=>false, :default=>false})
-> 0.0026s
-- remove_column(:application_settings, :elasticsearch_analyzers_kuromoji_enabled, :bool, {:null=>false, :default=>false})
-> 0.0008s
-- remove_column(:application_settings, :elasticsearch_analyzers_smartcn_search, :bool, {:null=>false, :default=>false})
-> 0.0007s
-- remove_column(:application_settings, :elasticsearch_analyzers_smartcn_enabled, :bool, {:null=>false, :default=>false})
-> 0.0007s
== 20201019101549 AddEsCustomAnalyzersSettings: reverted (0.0063s) ============
Screenshots
Useful links
- How to Search Chinese, Japanese, and Korean Text with Elasticsearch 6.2 - Part 1: Analyzers
- How to Search Chinese, Japanese, and Korean Text with Elasticsearch 6.2 - Part 2: Multi-fields
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Related to #244347 (closed)