16 Replies
@lee
in your example, is the 'title' field a string or an array
string
sounds like you want a full text search index https://docs.convex.dev/text-search
Full Text Search | Convex Developer Hub
Run search queries over your Convex documents
This is the query, when i do have a searchQ, i want to just query based on if the name contains the needed search
First issue is: A name.
Must be unique per table.
What if i have the same name for files owned by different users ? Would that cause an issue ?
OHHH, Nevermind, thats the column name
Am i correct ?
A name. Must be unique per table.is referring to the name of the search index, which is a single string configured in your schema.ts in the example in the docs, the name is "search_body"
Okay so in the updated code, i dont think i can use withIndex and withSearchIndex
you can only use one index at a time yeah. you can make
userId
a filter field on the search index
btw since you asked about whether js filters are slow, this may be of interest: https://discord.com/channels/1019350475847499849/1195755890838622359
Hmm it seems im getting an error here
Argument of type 'string' is not assignable to parameter of type 'never'.
on userId
OHH I have to add it to the filter fields, wow
Okay that was tough to wrap my head around, does it mean i have to keep the index for the userId if i want to use it seperately ?
yep if you want to query just by user id i would keep the index on that. you can add
isArchived
as another filter field if you want
Also one more question, how can i make it when args.searchQ is not defined, i just return everything ?
if you want to return everything, you can't use a search index for that, so something like
Ahh i see i have to have an if else statememt
Oh wait, just a question, once i collect the data, i cannot run a query on them can i ?
i'm not sure what you mean by "run a query on them"
you can manipulate the documents however you want in javascript
Oh wait nvm, im trying to put my .net sql logic in here
Thank you so much for your help! I really appreciate it
happy to help. Reach out again if u have questions