vectorSearch, filtering 2 fields using and
Hi!
In my schema i have a table with content, embedings, spaceId and partnerId, i want to search records only belonging to a spaceId AND partnerId, but the filter for vectorSearch only acceprs eq.or, i can't do an AND.
My vectorIndex is this:
.vectorIndex("by_embedding",{
vectorField: "embedding",
dimensions:1536,
filterFields:['spaceId', 'partnerId']
})
and in my action i want to filter out non related records like this:
const results = await ctx.vectorSearch("documents", "by_embedding", {
vector: embedding,
limit: 16,
filter: q => q.eq("spaceId", args.spaceId)
})
i want something like
q => q.and( q.eq("spaceId", 1), ( q.eq("partnerId", 1))
Is this possible?
2 Replies
hey @Rodrigo-R ! we currently don't have support for ANDs, but I outlined a workaround in this thread: https://discord.com/channels/1019350475847499849/1246197700009922692/1246208073039872030
lmk if it works for you
works for me, it's a bit dirty, but i've done dirtiest things in my code before 😉
thank you very much!