Allow blob num_context_lines to be specified
What does this MR do and why?
Adds an optional param num_context_lines to allow users to specify how many lines of code their blob search results should show before and after the matching line, defaulting to 2.
This param is available for web and API.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Web | API | |
|---|---|---|
| default | ![]() |
![]() |
num_context_lines=10 |
![]() |
![]() |
How to set up and validate locally
Verify that the number of code lines before and after a matching search term changes when specifying num_context_lines:
- Run a blob search web request without
num_context_lines: http://127.0.0.1:3000/search?scope=blobs&search=test&search_type=advanced - Run a blob search web request with
num_context_lines=10: http://127.0.0.1:3000/search?scope=blobs&search=test&search_type=advanced&num_context_lines=10 - Run a blob search API request without
num_context_lines: http://127.0.0.1:3000/api/v4/search?scope=blobs&search=test&search_type=advanced - Run a blob search API request with
num_context_lines=10: http://127.0.0.1:3000/api/v4/search?scope=blobs&search=test&search_type=advanced&num_context_lines=10
Related to #468311 (closed)
Edited by Madelein van Niekerk



