Looked up all the forum and found some people with the same problem but nothing was conclusive for me.
I want to run my query but constrain the return for a set of known vectors. I know their Ids based on a pre-filter I do with my relational db.
how to include this info in the query?
Without finding any proper solution, what I’m doing is returning the vectors based on their ids and calculating the similarity manually and then ranking them. It solves my problem for now, but seems the wrong way of doing it and I’m still in disbelief that this is not implemented yet and I have to do it manually. Feels like I’m doing something wrong.
my current function in node.js is:
export async function pineconeReturnItems(query, topK, preFilterIds){ // topK is the number of results to return
console.log(‘pineconeReturnItems preFilterIds’, preFilterIds)
const queryObj = {
vector: query,
topK: topK,
};
if (preFilterIds && preFilterIds.length > 0) {
queryObj.filter = {
id: {$in: preFilterIds}
};
}
try {
const response = await sbertNamespace.query(queryObj);
return response;
} catch (error) {
console.error('Error during pineconeReturnItems:', error);
}
}
and it returns nothing everytime I inlcude anything on preFilterIds. It works as expected if this array is empty (but that is not my use case).