diff --git a/go.mod b/go.mod index 77539d0..bbaa942 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24.0 require ( github.com/RoaringBitmap/roaring/v2 v2.14.5 - github.com/blevesearch/bleve_index_api v1.4.0 + github.com/blevesearch/bleve_index_api v1.4.1-0.20260729060817-8e56340f2a7e ) require ( diff --git a/go.sum b/go.sum index 5fe34fc..217b0d8 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/RoaringBitmap/roaring/v2 v2.14.5 h1:ckd0o545JqDPeVJDgeFoaM21eBixUnlWf github.com/RoaringBitmap/roaring/v2 v2.14.5/go.mod h1:eq4wdNXxtJIS/oikeCzdX1rBzek7ANzbth041hrU8Q4= github.com/bits-and-blooms/bitset v1.24.2 h1:M7/NzVbsytmtfHbumG+K2bremQPMJuqv1JD3vOaFxp0= github.com/bits-and-blooms/bitset v1.24.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/blevesearch/bleve_index_api v1.4.0 h1:xoCC4dvTizjcsZu7yO9Ua+/259K09BrirjTwLkx2MpY= -github.com/blevesearch/bleve_index_api v1.4.0/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= +github.com/blevesearch/bleve_index_api v1.4.1-0.20260729060817-8e56340f2a7e h1:WJ3JnFiBuZ0m1mXaniDHpbZxKU8hjp7SIhqHopSnaM4= +github.com/blevesearch/bleve_index_api v1.4.1-0.20260729060817-8e56340f2a7e/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= 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= github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= diff --git a/segment.go b/segment.go index 00b64a8..49d1d8b 100644 --- a/segment.go +++ b/segment.go @@ -273,3 +273,50 @@ type NestedSegment interface { // a parent document is deleted, all its nested child documents are also considered deleted. AddNestedDocuments(deleted *roaring.Bitmap) *roaring.Bitmap } + +// GeoShapeV2Segment is an optional interface that a Segment may implement +// to provide access to GeoShapeV2Data within the segment. +type GeoShapeV2Segment interface { + Segment + + // GeoShapeV2Data returns the geo shape data for the given field, + // excluding any documents present in the except bitmap. + GeoShapeV2Data(field string, except *roaring.Bitmap) (GeoShapeV2Data, error) +} + +// GeoShapeV2Data provides methods to access separate parts of the GeoShapeV2 data. +// Internally, geo docIDs are sequential from 0 to NumDocs()-1; DocNums() maps each +// geo docID (the slice index) to its segment document number. +type GeoShapeV2Data interface { + // InnerCells returns all of the shapes' inner cells in ascending order. + InnerCells() []uint64 + // InnerDocIDs returns the geo docIDs parallel to InnerCells(). + InnerDocIDs() []uint32 + // CrossCells returns all of the shapes' cross cells in ascending order. + CrossCells() []uint64 + // CrossDocIDs returns the geo docIDs parallel to CrossCells(). + CrossDocIDs() []uint32 + // NumDocs returns the number of documents indexed. + NumDocs() uint64 + // DocNums returns the mapping from geo docID (the slice index) to + // segment document number. + DocNums() []uint32 + // DocScores returns the precomputed inner and cross cell scores (in + // that order) for the documents indexed, each indexed by geo docID. + DocScores() (innerScores, crossScores []uint64) + // BoundingBox returns the bounding box bytes for the given geo docID. + BoundingBox(geoDocID uint32) ([]byte, error) + // Shape returns the shape bytes for the given geo docID. + Shape(geoDocID uint32) ([]byte, error) + // Excluded returns the bitmap of geo document IDs that are excluded + // from the index. + Excluded() *roaring.Bitmap + // GetScoreMap returns an empty score map, keyed by geo docID, from a + // segment-level pool. + GetScoreMap() map[uint32]uint64 + // PutScoreMap clears the score map obtained via GetScoreMap and + // returns it to the segment-level pool. + PutScoreMap(scores map[uint32]uint64) + // Close closes the GeoShapeV2Data and releases any associated resources. + Close() +}