From cde12f34d6e1c17082a4c8fd2062a471ee635836 Mon Sep 17 00:00:00 2001 From: CascadingRadium Date: Thu, 12 Jun 2025 01:38:46 +0530 Subject: [PATCH 01/13] first draft --- segment.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/segment.go b/segment.go index 122a28d..87e14fe 100644 --- a/segment.go +++ b/segment.go @@ -243,3 +243,9 @@ type Synonym interface { Size() int } + +type NestedSegment interface { + Segment + + NestedDictionary(field string, path string, arrayPosition int) (TermDictionary, error) +} From 6e5ec9ae441959e20a3a00b787f0b210a0aa774a Mon Sep 17 00:00:00 2001 From: CascadingRadium Date: Tue, 8 Jul 2025 00:56:32 +0530 Subject: [PATCH 02/13] interface change --- segment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segment.go b/segment.go index 87e14fe..9891d13 100644 --- a/segment.go +++ b/segment.go @@ -247,5 +247,5 @@ type Synonym interface { type NestedSegment interface { Segment - NestedDictionary(field string, path string, arrayPosition int) (TermDictionary, error) + NestedDictionary(nestedState index.NestedState, field string) (TermDictionary, error) } From 7d484f974408745f389246314a3a86fb951c603a Mon Sep 17 00:00:00 2001 From: CascadingRadium Date: Fri, 22 Aug 2025 17:11:14 +0530 Subject: [PATCH 03/13] new Ancestors() API --- segment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segment.go b/segment.go index 9891d13..6ffa184 100644 --- a/segment.go +++ b/segment.go @@ -247,5 +247,5 @@ type Synonym interface { type NestedSegment interface { Segment - NestedDictionary(nestedState index.NestedState, field string) (TermDictionary, error) + Ancestors(docID uint64) []uint64 } From 69d4841fac53b21fa3e65aa372d0c45e94ff1b03 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Sat, 13 Sep 2025 19:25:41 +0530 Subject: [PATCH 04/13] comments --- segment.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/segment.go b/segment.go index 6ffa184..729ac39 100644 --- a/segment.go +++ b/segment.go @@ -244,8 +244,17 @@ 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 document IDs for the given document ID. + // If the document has no ancestors or if the segment does not support nested documents, + // an empty slice is returned. Ancestors(docID uint64) []uint64 + + // Descendants returns a slice of descendant document IDs for the given document ID. + // If the document has no descendants or if the segment does not support nested documents, + // an empty slice is returned. + Descendants(docID uint64) []uint64 } From f18e31a34ceb4c3ad954120683a178bae724c963 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Tue, 14 Oct 2025 18:37:32 +0530 Subject: [PATCH 05/13] CountRoot API --- segment.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/segment.go b/segment.go index 729ac39..fcc6353 100644 --- a/segment.go +++ b/segment.go @@ -257,4 +257,10 @@ type NestedSegment interface { // If the document has no descendants or if the segment does not support nested documents, // an empty slice is returned. Descendants(docID uint64) []uint64 + + // 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 } From f652df9984bb8f1d6e7e95afd2da134ade463a72 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Tue, 14 Oct 2025 20:46:41 +0530 Subject: [PATCH 06/13] new API --- segment.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/segment.go b/segment.go index fcc6353..e64f6dd 100644 --- a/segment.go +++ b/segment.go @@ -263,4 +263,9 @@ type NestedSegment interface { // 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 } From 84ad4a02992220b5087fcc024bd9e36059750889 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Thu, 23 Oct 2025 19:58:37 +0530 Subject: [PATCH 07/13] remove descendants --- segment.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/segment.go b/segment.go index e64f6dd..79243cf 100644 --- a/segment.go +++ b/segment.go @@ -253,11 +253,6 @@ type NestedSegment interface { // an empty slice is returned. Ancestors(docID uint64) []uint64 - // Descendants returns a slice of descendant document IDs for the given document ID. - // If the document has no descendants or if the segment does not support nested documents, - // an empty slice is returned. - Descendants(docID uint64) []uint64 - // 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. From 0a12445b8ede620130e5ef9bba74725fdfeedf3a Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Tue, 11 Nov 2025 11:38:42 +0530 Subject: [PATCH 08/13] HasNestedDocs API --- segment.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/segment.go b/segment.go index 79243cf..534e9f0 100644 --- a/segment.go +++ b/segment.go @@ -248,6 +248,8 @@ type Synonym interface { // to provide access to nested document relationships within that segment. type NestedSegment interface { Segment + // HasNestedDocs checks if the segment has any documents with ancestry (i.e., nested documents). + HasNestedDocs() bool // Ancestors returns a slice of ancestor document IDs for the given document ID. // If the document has no ancestors or if the segment does not support nested documents, // an empty slice is returned. From 63c885dd31a443f0752ce936b6cb8db7a04d4148 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Tue, 11 Nov 2025 13:29:16 +0530 Subject: [PATCH 09/13] remove API --- segment.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/segment.go b/segment.go index 534e9f0..79243cf 100644 --- a/segment.go +++ b/segment.go @@ -248,8 +248,6 @@ type Synonym interface { // to provide access to nested document relationships within that segment. type NestedSegment interface { Segment - // HasNestedDocs checks if the segment has any documents with ancestry (i.e., nested documents). - HasNestedDocs() bool // Ancestors returns a slice of ancestor document IDs for the given document ID. // If the document has no ancestors or if the segment does not support nested documents, // an empty slice is returned. From 846c521200d8105277fde9e3badbcc0e52867850 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Wed, 26 Nov 2025 20:19:13 +0530 Subject: [PATCH 10/13] interface change --- segment.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/segment.go b/segment.go index 79243cf..1b6414f 100644 --- a/segment.go +++ b/segment.go @@ -248,10 +248,10 @@ type Synonym interface { // to provide access to nested document relationships within that segment. type NestedSegment interface { Segment - // Ancestors returns a slice of ancestor document IDs for the given document ID. + // 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, - // an empty slice is returned. - Ancestors(docID uint64) []uint64 + // a slice containing only the document ID itself is returned. + Ancestors(docID uint64) []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 From eb5ca51b4f190c1481f6989d4e59299e391c5b49 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Thu, 27 Nov 2025 12:17:34 +0530 Subject: [PATCH 11/13] allow prealloc --- segment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segment.go b/segment.go index 1b6414f..4e2dbad 100644 --- a/segment.go +++ b/segment.go @@ -251,7 +251,7 @@ type NestedSegment interface { // 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) []index.AncestorID + 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 From dcaa538608be831f410bb1a9a67f3ce72f3254e6 Mon Sep 17 00:00:00 2001 From: Rahul Rampure Date: Tue, 2 Dec 2025 15:12:49 +0530 Subject: [PATCH 12/13] update workflows --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 68da8e7..e0c425b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: From 520c9c5711ac589a51bae70a42d0d305289b1feb Mon Sep 17 00:00:00 2001 From: Abhinav Dangeti Date: Fri, 9 Jan 2026 09:52:26 -0700 Subject: [PATCH 13/13] Upgrade bleve_index_api * 049020a Rahul Rampure | [v17] Change FieldIndexingOptions type from int to uint64 * 09f96c8 Rahul Rampure | [v17] MB-27666: Nested Fields --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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=