Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to build single sql query for QSQLite for full text search on table
Forum Updated to NodeBB v4.3 + New Features

How to build single sql query for QSQLite for full text search on table

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    im using QSQLite in Qt 4.8 and trying to do Full Text Search
    im trying to find away to build query that preform text search using LIKE and %str%
    or maybe other query.
    i have table with N columns and i like to build query so if i search "foo"
    it will give me as results all the rows that part or all of the strings in one of the row columns contains "foo". what is the best way to do it in SQLite? does SQLite FTS3 and FTS4 Extensions supported ?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

      SQLite has FTS3 from version 3.5.0 and FTS4 from 3.7.4 (you could read it "here":http://www.sqlite.org/fts3.html ). And Qt 4.8 QSQLITE driver is built with SQLite version 3.7.7.1 (you could read it in the Qt's sources).

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        i compiled the driver with the full text support , its the only way from what i was reading

        1 Reply Last reply
        0
        • U Offline
          U Offline
          umen242
          wrote on last edited by
          #4

          i have new problem , after its working and gives me good results , in the presentation layer im using
          its Tableview and QSqlQueryModel.
          when i get the results , it is adding me more blank headers into the exciting table result.
          this is how the sql query looks like this , inside the QSqlQueryModel subclass :
          @void ListSqlModel::setFullTextSearchListQuery(const QString &query)
          {
          QString tbl = LIST_TBL;
          QString queryFullTextSearch = "SELECT * FROM "+tbl +" WHERE "+tbl+" MATCH '"+query+"'";
          QSqlQueryModel::setQuery(queryFullTextSearch, queryDB); // queryDB is QSqlDatabase im using

          }@

          1 Reply Last reply
          0
          • P Offline
            P Offline
            p-himik
            wrote on last edited by
            #5

            Could you wrap your code in @-signs?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved