feat(search): full unique path first + immediate folder in results (#51)
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 21s
Tests / Test (Go stable) (pull_request) Successful in 26s
Release Please / Release Please (push) Skipped
Release / GoReleaser (push) Skipped
Tests / Secret scan (gitleaks) (push) Skipped
Tests / Test (Go 1.25) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Tests / Secret scan (gitleaks) (pull_request) Successful in 4s
Tests / Test (Go 1.25) (pull_request) Successful in 21s
Tests / Test (Go stable) (pull_request) Successful in 26s
This commit is contained in:
+10
-4
@@ -274,13 +274,19 @@ func parseESSearchResponse(raw []byte) ([]SearchHit, error) {
|
||||
if h.Source.ID == 0 {
|
||||
id = h.ID
|
||||
}
|
||||
// Folders is the ancestor breadcrumb in root → leaf order, so the last
|
||||
// entry is the immediate parent (the previous "first" value was the
|
||||
// project root, which made every result look like it lived in #522).
|
||||
var parent string
|
||||
path := make([]string, 0, len(h.Source.Folders))
|
||||
for i, f := range h.Source.Folders {
|
||||
path = append(path, f.FolderID)
|
||||
if i == 0 {
|
||||
parent = f.FolderID
|
||||
for _, f := range h.Source.Folders {
|
||||
if strings.TrimSpace(f.FolderID) == "" {
|
||||
continue
|
||||
}
|
||||
path = append(path, f.FolderID)
|
||||
}
|
||||
if len(path) > 0 {
|
||||
parent = path[len(path)-1]
|
||||
}
|
||||
hits = append(hits, SearchHit{
|
||||
Entry: Entry{
|
||||
|
||||
Reference in New Issue
Block a user