I have three fts virtual tables in my sqlite database - two with one content column and one with two columns - the header and content. Let's say that one table is for the content and headings of some articles, and the other two are for reviews and their notes. Is there a way to fix the search among all in one query? I need to combine all the results and sort them by relevance, first the articles and their titles, then reviews and notes. I made some workaround. I populate the table with search results to display on every new search, but I think this is not a good idea:
DROP TABLE IF EXISTS srch_res;
CREATE TABLE srch_res(type integer, docid integer, snippet text, rank numeric);"
INSERT INTO srch_res SELECT '0', docid, snippet(reviews_c), rank(matchinfo(reviews_c), 0.5) FROM reviews_c WHERE reviews_c MATCH '%s';
INSERT INTO srch_res SELECT '1', docid, snippet(notes_c), rank(matchinfo(notes_c), 0.25) FROM notes_c WHERE notes_c MATCH '%s';
INSERT INTO srch_res SELECT '2', docid, snippet(arts_c), rank(matchinfo(arts_c), 1.0, 0.75) FROM arts_c WHERE arts_c MATCH '%s';
source
share