This is more of a design question - not just a coding question.
I already have an app that stores data in SQLite DB tables. Now I want to add Search feature into this.
I understand that in order to enable search feature I need FTS tables.
The tables that I have are (not exactly the same but giving very similar example):
Content table - has columns like: Id, Title, Content, Created By, Created On, Changed By, Changed on etc ...
Comments table - has columns like: Id, Comments, Created By, Created On, In Reply to etc ...
Other tables like User Data, Meta Data, Categories, Tags etc.
Here I only want search capability on Title, Content and Comments. Obviously I don't need search capability on other columns like created by etc.
Which is the best option ?
Problems that I see with option 1 are:
Problems that I see with option 2 are:
So, what is the best option ? Has any body faced similar challenges ?
FTS tables cannot be efficiently queried for non-FTS searches, so option 1 is out.
The entire FTS table essentially is an index. This is a speed/space tradeoff, and the ability to do full-text searches usually is worth it. To avoid storing the original text twice, use external content tables.
To keep the original and FTS tables in sync, use triggers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With