diff --git a/go.mod b/go.mod index 01f6c9c..690ceee 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24 require ( github.com/RoaringBitmap/roaring/v2 v2.4.5 - github.com/blevesearch/bleve_index_api v1.2.12-0.20260109154621-f19a6d6af728 + github.com/blevesearch/bleve_index_api v1.2.12-0.20260109165046-049020a048f7 ) require ( diff --git a/go.sum b/go.sum index 48edeeb..b1c25ee 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/RoaringBitmap/roaring/v2 v2.4.5 h1:uGrrMreGjvAtTBobc0g5IrW1D5ldxDQYe2 github.com/RoaringBitmap/roaring/v2 v2.4.5/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0= github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA= github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/blevesearch/bleve_index_api v1.2.12-0.20260109154621-f19a6d6af728 h1:qFnvr+SqVOCbhMl5sVynhuwVkv1yrc7Vhrn8lVdw1nU= -github.com/blevesearch/bleve_index_api v1.2.12-0.20260109154621-f19a6d6af728/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= +github.com/blevesearch/bleve_index_api v1.2.12-0.20260109165046-049020a048f7 h1:4sr3ewS5WzEDz9bwjQ4vrq/nIhBD1FXcCkvecd8OKfE= +github.com/blevesearch/bleve_index_api v1.2.12-0.20260109165046-049020a048f7/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/segment.go b/segment.go index 122a28d..4e2dbad 100644 --- a/segment.go +++ b/segment.go @@ -243,3 +243,24 @@ type Synonym interface { 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 + + // 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 +}