Performs binary search in the gallery index B-tree. The search is performed recursively, traversing the tree based on key comparisons. At each node:
Search key (4 bytes from SHA-256 hash)
Current node being searched
Gallery index version
Tuple of [offset, length] pointing to matching gallery data, or undefined if not found
const key = await sha256First4Bytes("search term");const rootNode = await getNodeAtAddress(0n, version);const result = await binarySearch(key, rootNode, version); Copy
const key = await sha256First4Bytes("search term");const rootNode = await getNodeAtAddress(0n, version);const result = await binarySearch(key, rootNode, version);
Performs binary search in the gallery index B-tree. The search is performed recursively, traversing the tree based on key comparisons. At each node: