Skip to content

Update search data when :issues_full_text_search is enabled

Carla Drago requested to merge 361219-show-imported-issues-in-search into master

What does this MR do and why?

When the :issues_full_text_search feature is enabled, searching for issues is done using the search vectors saved to the issue_search_data table. This table is customarily updated with a search vector based on the issue title and issue description, and is run as a callback by the ActiveRecord issue create process.

Our GitHub issue importer, however, does not use ActiveRecord. Instead, to improve performance, it uses a bulk insert method that writes directly to the database but does not create any corresponding search data record. This has meant that on any environment where :issues_full_text_search is enabled, there have been no search_vectors for the full text search to query, resulting in empty results.

This fix adds the method used by the ActiveRecord callback to the GitHub issue importer, so that search_vectors are created for corresponding issues, resulting in correct issue search results.

Screenshots or screen recordings

example_of_bug

example_of_fixed

How to set up and validate locally

  1. Create a new project by importing a project from GitHub
    • Menu -> Projects -> Create New Project -> Import Project -> Import project from GitHub
    • You will need a GitHub personal access token with repo access
  2. Once the import is complete, select the Go To Project button
  3. Visit Issues -> List
  4. Search for an issue using a known title or description text.
  5. The issue/issues should appear in the listed results.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #361219 (closed)

Edited by Carla Drago

Merge request reports

Loading