search on all `with` and `columns` fields via text (sqlite)
Hi! I'm using
better-sqlite3
as the driver. I have a bunch of fields selected via columns
& with
(nested fields) & an offset based pagination. I'm using the querybuilder (.query
). How would I go about performing a full text search on the selected columns as well as the selected nested columns? Say,
I'm including towards using where: or(x, or(y, or()))
but i'm not sure that's correct (& would work for slected nested relations). Let me know!!7 Replies
I can't think of any good way of achieving what you want is sql
I think you are better off serching at the application level
Thank you @Angelelz! (i apologize for ping!!) This is what I ended up doing. Do you think it's possible by building sql queries via drizzle instead of using the drizzle
.query
builder. I'm not too good at SQL so I had no choice other than using query builder for this but just wondering.There are many way of searching through many columns. but I'm not sure it can be through several tables in the same query
Maybe a concat with several column from a join?
How big is the content in each column?
There are many way of searching through many columns. but I'm not sure it can be through several tables in the same query Maybe a concat with several column from a join?That's interesting! Getting the data & joining is not difficult. I'm just stuck on searching (hopefully a text search) across the
result: object[]
of all the joins
. If I may, could you point me to a few resources for many ways of searching through many columns (for sqlite!) if you're aware of any Angelelz.
How big is the content in each column?On most of the columns, the content is almost always 1-2 words long.
I don't know of resources honestly
But try searching for a way to concat strings in sqlite
I think there is the
||
operatorThat helps & I'll look for it! Thank you Angelelz. 💙
No problem
Also, see if sqlite have support for full text search