Skip to content

Commit

Permalink
Fallback to include up to first 9 lines if no match is found
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Castle <[email protected]>
  • Loading branch information
Kas-tle committed Sep 16, 2024
1 parent 1c00515 commit e396929
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ private String getDescriptionFieldBody(DocSearchResult result, String query, int
}
}

if (includedLines.isEmpty()) {
for (int i = 0; i < Math.min(lines.size(), 9); i++) {
includedLines.add(i);
}
}

int lastLine = -1;
for (int i : includedLines) {
if (lastLine != -1 && i - lastLine > 1) {
Expand Down

0 comments on commit e396929

Please sign in to comment.