Skip to content

Conversation

@abhinavdangeti
Copy link
Member

No description provided.

@deepkaran
Copy link
Collaborator

Btw, if you don't want to change faiss, you can do the reconstruct in cgo as well

// Get quantizer, nlist, d
q := C.faiss_IndexIVF_quantizer(ivf)
if q == nil {
	return nil, 0, fmt.Errorf("IVF quantizer is nil")
}
nlist := int(C.faiss_IndexIVF_nlist(ivf))
d = int(C.faiss_Index_d(q))

if nlist == 0 {
	return [][]float32{}, d, nil
}

// Reconstruct all centroids [0..nlist-1] into a flat slice
buf := make([]float32, nlist*d)
rc := C.faiss_Index_reconstruct_n(
	q,
	0,                         // i0
	C.idx_t(nlist),            // ni
	(*C.float)(unsafe.Pointer(&buf[0])),
)
if rc != 0 {
	return nil, 0, fmt.Errorf("reconstruct_n failed (rc=%d)", int(rc))
}

@abhinavdangeti abhinavdangeti merged commit 7e59607 into bleve Sep 17, 2025
@abhinavdangeti abhinavdangeti deleted the mb66396 branch September 17, 2025 20:26
abhinavdangeti added a commit to blevesearch/go-faiss that referenced this pull request Nov 7, 2025
ns-codereview pushed a commit to couchbase/cbft that referenced this pull request Nov 11, 2025
Requires:
- blevesearch/faiss#54
- blevesearch/bleve#2207

REST endpoints:
- POST /api/index/{indexName}/insights
- POST /api/bucket/{bucketName}/scope/{scopeName}/index/{indexName}/insights
    - RequestBody:
        `{"field": "<fieldName>", "insight": "termFrequencies", "limit": 5, "descending": false}`
        `{"field": "<fieldName>", "insight": "centroidCardinalities", "limit": 5, "descending": true}`

- Scatter gather request uses RESTful IndexClient(s).

Change-Id: Ib9b7782e3fe80f0e6bf93905e5a5f1bb76d8fb71
Reviewed-on: https://review.couchbase.org/c/cbft/+/232479
Tested-by: Abhi Dangeti <abhinav@couchbase.com>
Well-Formed: Build Bot <build@couchbase.com>
Reviewed-by: Rahul Rampure <rahul.rampure@couchbase.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants