Backend merge request label facet: Introduce new document field
Problem to solve
This is a step towards providing feature parity with the merge requests list with filters. This will add backend support for indexing and searching labels for merge request documents
Proposal
This should be delivered across multiple MRs.
Introduce new field and backfill
- introduce an Advanced search migration to add a new field to the merge requests mappings named
label_idswith type ofkeyword.
- In
MergeRequestInstanceProxypopulatelabel_ids(example inIssueInstanceProxy) and bump theschema_version(format isYY_MM)
- Note: the
label_idsshould only be populated once the migration above is complete. You can use::Elastic::DataMigrationService.migration_has_finished?to check
- add labels to
preload_indexing_datain MergeRequestClassProxy - update the
'does not have N+1 queries for merge_requests'spec for merge request indexing to add project and group labels to the merge requests created for testing N+1 in indexing - update the spec for testing
as_indexed_json.
- add
label_idsto the main'returns json with all needed elements'test - add a spec to make sure
label_idsare not populated if the migration is not complete (example spec)
- ensure that labels deleted will cause an update to indexed data that references the labels. see
ee/app/models/ee/label_link.rb
Edited by Terri Chu