0

I'm working on a search tool, the words (to be searched) are in object array first I search the database(about 450k rows) using FTS4 and sqlite. This works fast, the SQL I'm using is:

String s =  "select * from  fts_sggs where word_text MATCH ? ";

but then, I need some extra words which are a part of the same table. The FTS4 doesn't seem to work here. The SQL is:

String s ="select * from fts_sggs where word_number BETWEEN " + wordnumlo + " AND " + wordnumhi + " and page_number =" + pgnum;

I'm a newbie to SQL Programming, I need a single query that could perform both tasks fast. this is being done in java which is terribly slow.

Jonas
  • 121,568
  • 97
  • 310
  • 388
  • Welcome to SO! Would a UNION be an idea for you, since you return same structure ? `https://www.sqlitetutorial.net/sqlite-union/` If second query depends on first query have a look at "recursive" query for SQLite. – MyICQ Mar 25 '21 at 13:14
  • UNION no idea ! recursive ill try – Isherpal Singh Mar 25 '21 at 13:16
  • 1
    `select * from fts_sgss where word_text MATCH ? UNION select * from fts_sgss where...` is one example. Here, the two queries are separate and last does not depend on results from first one. – MyICQ Mar 25 '21 at 13:22
  • UNION worked but only for first item rest 9326 were all only the first query output – Isherpal Singh Mar 25 '21 at 13:46
  • Could you edit your post and make a simplified example of some data example ? – MyICQ Mar 25 '21 at 13:57

0 Answers0