kamal.panara
kamal.panara
Explore posts from servers
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
Using triggers to keep everything in sync
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
Yes I’m currently trying out this approach
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
Large data per organisation, like upto from 3K to 500K documents per organisation.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
and scaning whole table everytime is inefficient, because i expect lot of documents.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
i want to load 10 docs that matching from all docs.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
i have 80 docuemnts for testing, and i load 10 docs per page, so filter applies to 10 docs only. then when i hit load more i see more matching docs but it's not good UX because if there are only 3 matching results in first page, user thinks that, that's all matching docs because per page it should load 10 docs.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
i konw that it works, main problem with this logic is it only works if all your matching documents are in first page. how many docs are you loading per page ? try addding more docuemnts
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
as i said you can remove users & org tables & related fields from contacts & tags table.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
thats my schema.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
you can ignore user auth, org stuff from query.
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
i now kinda understand your logic, but i think it will only find exact match ? or it will work like my ts filter .some includes query ?
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
that filter is ts filter, not convex db filter, convex doesn't support .include queries, does it ?
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
can you please explain a bit on how to implement this ?
25 replies
CCConvex Community
Created by kamal.panara on 5/10/2025 in #general
advance filtering
My schema looks like this.
contacts: defineTable({
...other fields...
tags: v.optional(v.array(v.id("tags"))),
searchFields: v.optional(v.string()),
}),


tags: defineTable({
...other fields...
name: v.string(),
status: v.union(v.literal("active"), v.literal("deleted")),
}),
contacts: defineTable({
...other fields...
tags: v.optional(v.array(v.id("tags"))),
searchFields: v.optional(v.string()),
}),


tags: defineTable({
...other fields...
name: v.string(),
status: v.union(v.literal("active"), v.literal("deleted")),
}),
My existing query looks like this:
const results = ((args.searchKeyword || "").trim().length > 0)
? await ctx.db
.query("contacts")
.withSearchIndex("search_fields", (q) =>
q.search('searchFields', args.searchKeyword!)
.eq("organizationId", orgId._id)
.eq("status", "active"),
)
.paginate(args.paginationOpts)
: await ctx.db
.query("contacts")
.withIndex("by_org_id_status", (q) =>
q.eq("organizationId", orgId._id)
.eq("status", "active"),
)
.paginate(args.paginationOpts);
// issue: this method leads to filter only contacts in current page.
if (args.filterByTags && args.filterByTags.length > 0) {
results.page = results.page
.filter((contact) =>
contact.tags?.some(tag => args.filterByTags?.includes(tag))
);
}
const results = ((args.searchKeyword || "").trim().length > 0)
? await ctx.db
.query("contacts")
.withSearchIndex("search_fields", (q) =>
q.search('searchFields', args.searchKeyword!)
.eq("organizationId", orgId._id)
.eq("status", "active"),
)
.paginate(args.paginationOpts)
: await ctx.db
.query("contacts")
.withIndex("by_org_id_status", (q) =>
q.eq("organizationId", orgId._id)
.eq("status", "active"),
)
.paginate(args.paginationOpts);
// issue: this method leads to filter only contacts in current page.
if (args.filterByTags && args.filterByTags.length > 0) {
results.page = results.page
.filter((contact) =>
contact.tags?.some(tag => args.filterByTags?.includes(tag))
);
}
I want to filter contacts which includes tags that user is filtering with pagination & search.
25 replies
CCConvex Community
Created by noob saibot on 5/3/2025 in #support-community
How to implement Full Text Search with multiple search indexes
No description
4 replies
CCConvex Community
Created by noob saibot on 5/3/2025 in #support-community
How to implement Full Text Search with multiple search indexes
No description
4 replies