Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !7612

Closed
Created Aug 26, 2014 by Administrator@rootOwner
  • Report abuse
Report abuse

Adding snippet search capability

  • Overview 33
  • Commits 3
  • Changes 12

Created by: bushong1

In reference to this merge request:

http://feedback.gitlab.com/forums/176466-general/suggestions/5529795-search-though-snippets

What does this MR do?

Adds the capability to search snippets. This can be accessed whenever viewing a snippet related page, such as personal snippets, snippet discovery, and search snippets. There is a tab for searching just filenames and titles, and there is a tab for searching just the code of the snippet. It searches all public snippets, as well as the private snippets of the user.

Are there points in the code the reviewer needs to double check?

The biggest change is the creation of snippet_service.rb in app/services/search/snippet_service.rb. One thing I was unsure of was if there is any specific limit on how many snippet results should be returned in total from the query. I didn't want to leave it unlimited, as a user could search for a single character and potentially slow down the system. I put the limit at an arbitrary 500, paginating at 20 for the user, but someone may want to make a judgement call.

Why was this MR needed?

This is something my users have been asking for, and it should add a great amount of collaborative capability and global discovery to the snippets feature. In addition, there is a merge request already created with 9 points.

What are the relevant issue numbers / Feature requests?

http://feedback.gitlab.com/forums/176466-general/suggestions/5529795-search-though-snippets

Screenshots (If appropiate)

Image 1: Searching title/filename with no results. selection_005

Image 2: Searching code with results. selection_006

Image 3: Searching title/filename with paginated results, first page. (the black bar towards the bottom is just ubuntu butting in while i maximize for a screenshot) selection_007 Image 4: Searching title/filename with paginated results, second page. selection_008 Image 5: "Search Snippets" in search bar available on this page. selection_009 Image 6: Searching in code will display text 3 lines before and 3 lines after any matches. It will collapse overlapping matches into one block. selection_010

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/bushong1/snippet-search