MCPcopy
hub / github.com/dgraph-io/dgraph / prefixesToDropVectorIndexEdges

Function prefixesToDropVectorIndexEdges

posting/index.go:1695–1711  ·  view source on GitHub ↗

This needs to be moved to the implementation of vector-indexer API

(ctx context.Context, rb *IndexRebuild)

Source from the content-addressed store, hash-verified

1693
1694// This needs to be moved to the implementation of vector-indexer API
1695func prefixesToDropVectorIndexEdges(ctx context.Context, rb *IndexRebuild) [][]byte {
1696 // Exit early if indices do not need to be rebuilt.
1697 op := rb.needsVectorIndexEdgesRebuild()
1698 if op == indexNoop {
1699 return nil
1700 }
1701
1702 prefixes := append([][]byte{}, x.PredicatePrefix(hnsw.ConcatStrings(rb.Attr, hnsw.VecEntry)))
1703 prefixes = append(prefixes, x.PredicatePrefix(hnsw.ConcatStrings(rb.Attr, hnsw.VecDead)))
1704 prefixes = append(prefixes, x.PredicatePrefix(hnsw.ConcatStrings(rb.Attr, hnsw.VecKeyword)))
1705
1706 for i := range hnsw.VectorIndexMaxLevels {
1707 prefixes = append(prefixes, x.PredicatePrefix(hnsw.ConcatStrings(rb.Attr, hnsw.VecKeyword, fmt.Sprint(i))))
1708 }
1709
1710 return prefixes
1711}
1712
1713func (rb *IndexRebuild) needsReverseEdgesRebuild() indexOp {
1714 x.AssertTruef(rb.CurrentSchema != nil, "Current schema cannot be nil.")

Callers 1

DropIndexesMethod · 0.85

Calls 3

PredicatePrefixFunction · 0.92
ConcatStringsFunction · 0.92

Tested by

no test coverage detected