How can I make this query return distinct resources:
const similarGuides = await db
.select({
resourceId: embeddings.resourceId,
title: resources.title,
content: resources.content,
type: resources.type,
iconPath: integrations.iconPath,
name: integrations.name,
similarity,
})
.from(embeddings)
.innerJoin(resources, eq(embeddings.resourceId, resources.id))
.innerJoin(integrations, eq(resources.integrationId, integrations.id))
.where(gt(similarity, 0.5))
.orderBy(t => desc(t.similarity))
.limit(4);
The solution should be straight forward I think but everything I try ends up in another error. I would appreciate some tips.