Make search related project archival features compatible with group archival
Prerequisite
Before you start, please check out the parent epic description to get the full context: Make project archival features compatible with ... (&19690)
Description
We ran a search for "archive" and "archival" in the codebase and pulled together the following relevant results for the search domain. We'd need your help with:
- Review the search results and update the code to use our new ancestor-aware methods and scopes wherever needed
- Creating new services/workers wherever they're needed
- Note: Not all "archive" mentions are about project archival – feel free to skip anything that's not relevant!
Archive/Archival Occurrences
Search
- 
ee/app/models/ee/project.rb - 
elastic_index_dependant_association :issues, on_change: :archived 
- 
elastic_index_dependant_association :work_items, on_change: :archived 
- 
elastic_index_dependant_association :merge_requests, on_change: :archived 
- 
elastic_index_dependant_association :notes, on_change: :archived 
- 
elastic_index_dependant_association :milestones, on_change: :archived 
 
- 
- 
ee/lib/elastic/latest/merge_request_instance_proxy.rb 
- 
ee/lib/elastic/latest/note_config.rb 
- 
ee/lib/elastic/latest/commit_config.rb 
- 
ee/lib/elastic/latest/merge_request_config.rb 
- 
ee/lib/elastic/latest/wiki_config.rb 
- 
ee/lib/elastic/latest/issue_instance_proxy.rb 
- 
ee/lib/elastic/latest/project_config.rb 
- 
ee/lib/elastic/latest/milestone_instance_proxy.rb 
- 
ee/lib/elastic/latest/git_class_proxy.rb - 
if archived_filter_applicable_for_commit_search?(options) 
- 
query_hash = context.name(:archived) { archived_filter(query_hash) } 
- 
def archived_filter_applicable_for_commit_search?(options) 
- 
!options[:include_archived] && options[:search_level] != 'project' 
- 
if type == 'blob' && archived_filter_applicable_for_blob_search?(options) 
- 
query_hash = archived_filter(query_hash) 
- 
def archived_filter_applicable_for_blob_search?(options) 
- 
!options[:include_archived] && options[:search_level] != 'project' 
 
- 
- 
ee/lib/elastic/latest/config.rb 
- 
ee/lib/elastic/latest/note_class_proxy.rb 
- 
ee/lib/elastic/latest/issue_config.rb 
- 
ee/lib/elastic/latest/note_instance_proxy.rb 
- 
ee/lib/elastic/latest/application_class_proxy.rb - 
def archived_filter(query_hash) 
- 
archived_false_query = { bool: { filter: { term: { archived: { value: false } } } } } 
- 
archived_missing_query = { bool: { must_not: { exists: { field: 'archived' } } } } 
- 
exclude_archived_query = { bool: { _name: context.name(:non_archived), 
- 
should: [archived_false_query, archived_missing_query] } } 
- 
query_hash[:query][:bool][:filter] << exclude_archived_query 
 
- 
- 
ee/lib/elastic/latest/project_instance_proxy.rb 
- 
ee/lib/elastic/latest/wiki_class_proxy.rb 
- 
ee/lib/search/elastic/references/vulnerability.rb 
- 
ee/lib/search/elastic/types/work_item.rb 
- 
ee/lib/search/elastic/milestone_query_builder.rb 
- 
ee/lib/search/elastic/filters.rb - 
def by_archived(query_hash:, options:) 
- 
include_archived = !!options[:include_archived] 
- 
return query_hash if include_archived 
- 
archived_false_filter = { bool: { filter: { term: { archived: { value: false } } } } } 
- 
archived_missing_filter = { bool: { must_not: { exists: { field: 'archived' } } } } 
- 
exclude_archived_filter = { bool: { _name: context.name(:non_archived), 
- 
should: [archived_false_filter, archived_missing_filter] } } 
- 
exclude_archived_filter 
 
- 
- 
ee/lib/search/elastic/references/work_item.rb 
- 
ee/lib/search/elastic/project_query_builder.rb 
- 
ee/lib/search/elastic/work_item_query_builder.rb 
- 
ee/lib/search/elastic/merge_request_query_builder.rb 
- 
ee/app/models/concerns/elastic/projects_search.rb 
- 
ee/lib/gitlab/elastic/indexer.rb 
- 
ee/lib/gitlab/elastic/project_search_results.rb 
- 
ee/lib/gitlab/elastic/search_results.rb - 
base_options.merge(filters.slice(:include_archived)) 
- 
filters.slice(:order_by, :sort, :confidential, :state, :label_name, :include_archived), klass: Issue) 
- 
base_options.merge({ features: [:issues, :merge_requests] }, filters.slice(:include_archived)) 
- 
base_options.merge(filters.slice(:language, :include_archived, :num_context_lines)) 
- 
base_options.merge(root_ancestor_ids: root_ancestor_ids).merge(filters.slice(:include_archived)) 
- 
:include_archived, 
 
- 
- 
ee/lib/ee/search/advanced_finders/work_items_finder.rb 
- 
ee/lib/search/zoekt/filters.rb 
- 
ee/lib/search/zoekt/search_results.rb 
- 
ee/lib/search/zoekt/code_query_builder.rb 
- 
app/helpers/search_helper.rb 
- 
app/services/concerns/search/filter.rb 
- 
ee/app/graphql/resolvers/search/blob/blob_search_resolver.rb 
- 
ee/app/workers/search/zoekt/project_marked_as_archived_event_worker.rb 
- 
ee/app/services/ee/search/project_service.rb 
- 
ee/app/services/search/zoekt/task_serializer_service.rb 
- 
ee/app/services/concerns/search/zoekt_searchable.rb 
- 
lib/gitlab/search_results.rb 
- 
lib/gitlab/search/params.rb