Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.21.x, 1.22.x, 1.23.x]
go-version: [1.23.x, 1.24.x, 1.25.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
21 changes: 21 additions & 0 deletions segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,24 @@

Size() int
}

// NestedSegment is an optional interface that a Segment may implement
// to provide access to nested document relationships within that segment.
type NestedSegment interface {
Segment
// Ancestors returns a slice of ancestor IDs for the given document ID.
// If the document has no ancestors or if the segment does not support nested documents,
// a slice containing only the document ID itself is returned.
Ancestors(docID uint64, prealloc []index.AncestorID) []index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, macos-latest)

undefined: index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, ubuntu-latest)

undefined: index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, ubuntu-latest)

undefined: index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.23.x, ubuntu-latest)

undefined: index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.24.x, macos-latest)

undefined: index.AncestorID

Check failure on line 254 in segment.go

View workflow job for this annotation

GitHub Actions / test (1.25.x, macos-latest)

undefined: index.AncestorID

// CountRoot returns the number of root documents in the segment, excluding any documents
// that are marked as deleted in the provided bitmap. If the segment does not support nested
// documents, it returns the total document count minus the count of deleted documents.
// A root document is defined as a document that is not a child of any other document.
CountRoot(deleted *roaring.Bitmap) uint64

// AddNestedDocuments updates the provided bitmap to include all nested documents
// associated with documents marked as deleted in the bitmap. This ensures that when
// a parent document is deleted, all its nested child documents are also considered deleted.
AddNestedDocuments(deleted *roaring.Bitmap) *roaring.Bitmap
}
Loading