Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
7b87224
Introducing Zapx V17
CascadingRadium Nov 11, 2025
647ea3f
remove debug print statements
CascadingRadium Nov 11, 2025
264f04e
Apply suggestions from code review
CascadingRadium Nov 11, 2025
df2401a
small error msg fix
CascadingRadium Nov 11, 2025
782a36c
fix footer
CascadingRadium Nov 11, 2025
1173c95
small fix in zap.md
CascadingRadium Nov 11, 2025
4780ed1
bug fixes and new features.
CascadingRadium Sep 13, 2025
af6c696
Update nested_cache.go
CascadingRadium Sep 13, 2025
3747c03
Update nested_cache.go
CascadingRadium Sep 13, 2025
e659767
Update merge.go
CascadingRadium Sep 13, 2025
aab8129
simplify
CascadingRadium Sep 13, 2025
a994bbd
Update nested_cache.go
CascadingRadium Sep 13, 2025
78d68b4
Update nested_cache.go
CascadingRadium Sep 13, 2025
9e51f9c
Update segment.go
CascadingRadium Sep 13, 2025
af9f3a4
Update segment.go
CascadingRadium Sep 13, 2025
460e568
Update segment.go
CascadingRadium Sep 13, 2025
d459929
Update segment.go
CascadingRadium Sep 13, 2025
45051aa
Update segment.go
CascadingRadium Sep 13, 2025
43d0c99
comments
CascadingRadium Sep 13, 2025
3fdd593
fix comments
CascadingRadium Sep 13, 2025
6c7a1bc
fix count API part1
CascadingRadium Oct 14, 2025
1070303
performance improvement
CascadingRadium Oct 14, 2025
38ec1ef
gomod changes
CascadingRadium Oct 16, 2025
2057857
cache improvement
CascadingRadium Oct 20, 2025
85aa9c9
code review
CascadingRadium Oct 23, 2025
c98b0c5
add zapx.md
CascadingRadium Nov 13, 2025
71b1151
add cmd line tooling
CascadingRadium Nov 13, 2025
5b46683
Apply suggestions from code review
CascadingRadium Nov 13, 2025
763ba00
reset to 16 for test
CascadingRadium Nov 17, 2025
3a14cca
revert to 17
CascadingRadium Nov 19, 2025
933cdfe
fix cmd line tool
CascadingRadium Nov 19, 2025
a091db2
Apply suggestions from code review
CascadingRadium Nov 19, 2025
c20a8b3
temp change to 16
CascadingRadium Nov 19, 2025
21873f9
perf optimization
CascadingRadium Nov 26, 2025
064c9a0
perf opt 3
CascadingRadium Nov 27, 2025
77bf6e8
nestedCache v2
CascadingRadium Nov 27, 2025
9c9f86b
cache optimization
CascadingRadium Nov 27, 2025
9032692
use clear instead
CascadingRadium Nov 28, 2025
43825ef
use uvarint
CascadingRadium Nov 28, 2025
3d8762b
reuse edgeList
CascadingRadium Nov 28, 2025
0e5ae09
add guard
CascadingRadium Nov 28, 2025
43688ea
Apply suggestions from code review
CascadingRadium Nov 28, 2025
0984d43
fix md
CascadingRadium Nov 30, 2025
ddf2d5a
Update github actions workflow (#350)
CascadingRadium Dec 10, 2025
b619c64
Moved vectorIndexWrapper implementations into a struct
Likith101 Dec 10, 2025
c73d9fc
Apply suggestion from @Copilot
abhinavdangeti Dec 10, 2025
5425f7d
fix tests
CascadingRadium Dec 10, 2025
dbd7e53
fix tests
CascadingRadium Dec 10, 2025
683ac3f
fix comments
CascadingRadium Dec 10, 2025
52630c6
rebase
CascadingRadium Dec 10, 2025
297d353
fix typos
CascadingRadium Dec 10, 2025
4bbbd0d
resolve comments
CascadingRadium Dec 10, 2025
d0e645a
add explicit l2 case
CascadingRadium Dec 10, 2025
466697a
rename var
CascadingRadium Dec 10, 2025
aa3db82
Addressing reviews
Likith101 Dec 11, 2025
df85930
Merge branch 'vecWrapper' into knnDup
CascadingRadium Dec 11, 2025
d04b0bd
change var name
CascadingRadium Dec 11, 2025
6c506d8
Merge branch 'knnDup' into merge
CascadingRadium Dec 11, 2025
7f8ab8d
Merge branch 'merge' into nestedFields
CascadingRadium Dec 11, 2025
c1fa881
knn support
CascadingRadium Dec 11, 2025
72ccec0
fox reuse
CascadingRadium Dec 11, 2025
dd4db74
Minor improvements
Likith101 Dec 11, 2025
f86bbbf
Merge branch 'vecWrapper' into knnDup
CascadingRadium Dec 11, 2025
4c50856
resolve comments
CascadingRadium Dec 11, 2025
23bb1e5
Merge branch 'knnDup' into merge
CascadingRadium Dec 11, 2025
f6d6ad1
Merge branch 'merge' into nestedFields
CascadingRadium Dec 11, 2025
2ffff1e
Minor bug fix
Likith101 Dec 11, 2025
8cb4bbd
Merge branch 'vecWrapper' into knnDup
CascadingRadium Dec 11, 2025
b4d5ebe
Merge branch 'knnDup' into merge
CascadingRadium Dec 11, 2025
ae9ef74
Merge branch 'merge' into nestedFields
CascadingRadium Dec 11, 2025
7ca55d8
bug fix
CascadingRadium Dec 12, 2025
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 @@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
Expand Down
9 changes: 8 additions & 1 deletion build.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
index "github.com/blevesearch/bleve_index_api"
)

const Version uint32 = 17
const Version uint32 = 16

const Type string = "zap"

Expand Down Expand Up @@ -170,6 +170,7 @@ func InitSegmentBase(mem []byte, memCRC uint32, chunkMode uint32, numDocs uint64
invIndexCache: newInvertedIndexCache(),
vecIndexCache: newVectorIndexCache(),
synIndexCache: newSynonymIndexCache(),
nstIndexCache: newNestedIndexCache(),
// following fields gets populated by loadFields
fieldsMap: make(map[string]uint16),
fieldsOptions: make(map[string]index.FieldIndexingOptions),
Expand All @@ -189,5 +190,11 @@ func InitSegmentBase(mem []byte, memCRC uint32, chunkMode uint32, numDocs uint64
return nil, err
}

// initialize any of the caches if needed
err = sb.nstIndexCache.initialize(sb.numDocs, sb.getEdgeListOffset(), sb.mem)
if err != nil {
return nil, err
}

return sb, nil
}
76 changes: 76 additions & 0 deletions cmd/zap/cmd/edge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright (c) 2025 Couchbase, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cmd

import (
"encoding/binary"
"fmt"

"github.com/spf13/cobra"
)

// edgeListCmd represents the edge command
var edgeListCmd = &cobra.Command{
Use: "edgeList",
Short: "prints the edge list for nested documents",
Long: `The edgeList command will print the edge list for nested documents in the segment.`,
RunE: func(cmd *cobra.Command, args []string) error {
edgeListAddr, err := segment.EdgeListAddr()
if err != nil {
return fmt.Errorf("error getting edge list: %v", err)
}
data := segment.Data()
// read edge list
// pos stores the current read position
pos := edgeListAddr
// read number of nested documents which is also the number of edges
numEdges, read := binary.Uvarint(data[pos : pos+binary.MaxVarintLen64])
if read <= 0 {
return fmt.Errorf("error reading number of edges in nested edge list")
}
pos += uint64(read)
// if no edges or no nested documents, return
if numEdges == 0 {
fmt.Println("no nested documents present")
return nil
}
// edgeList as a map[node]parent
edgeList := make(map[uint64]uint64, numEdges)
for i := uint64(0); i < numEdges; i++ {
child, read := binary.Uvarint(data[pos : pos+binary.MaxVarintLen64])
if read <= 0 {
return fmt.Errorf("error reading child doc id in nested edge list")
}
pos += uint64(read)
parent, read := binary.Uvarint(data[pos : pos+binary.MaxVarintLen64])
if read <= 0 {
return fmt.Errorf("error reading parent doc id in nested edge list")
}
pos += uint64(read)
edgeList[child] = parent
}
// print number of edges / nested documents
fmt.Printf("number of edges / nested documents: %d\n", len(edgeList))
fmt.Printf("child document number -> parent document number\n")
for child, parent := range edgeList {
fmt.Printf("%d -> %d\n", child, parent)
}
return nil
},
}

func init() {
RootCmd.AddCommand(edgeListCmd)
}
Loading
Loading