Full-text Search with SQLite

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Full-text Search with SQLite

  • Creator
    Topic
  • #54446
    Hai Nguyen
    Participant

      Hello,

      Does SQLite that embedded in Cloverleaf have a feature Full-text search? if so what version of Cloverleaf?

      I got SQL error when I tried to invoked the fts with Cloverleaf version 5.7:

      sqlite> CREATE VIRTUAL TABLE data USING fts3();

      SQL error: no such module: fts3

      Thank you,

      Hai Nguyen

    Viewing 8 reply threads
    • Author
      Replies
      • #81503

        Do you know what version of SQLite supports that function? Cloverleaf 6.1 embeds SQLite 3.7.10.

        -- Max Drown (Infor)

      • #81504
        Charlie Bursell
        Participant

          Wrong syntax Hai.  You have:

          CREATE VIRTUAL TABLE data USING fts3();

          Try it like this:

          CREATE VIRTUAL TABLE docs USING fts3(title, body);

          You have to define columns.  Here is what I get

          C:healthvisioncis5.8integratorlevel_3tclprocsLIB>sqlite test.db

          SQLite version 3.6.4

          Enter “.help” for instructions

          Enter SQL statements terminated with a “;”

          sqlite> CREATE VIRTUAL TABLE docs USING fts3(title, body);

          sqlite> .schema

          CREATE VIRTUAL TABLE docs USING fts3(title, body);

          CREATE TABLE docs_content(  docid INTEGER PRIMARY KEY,c0title,c1body);

          CREATE TABLE docs_segdir(  level integer,  idx integer,  start_block integer,  leaves_end_block integer,  end_block integer,  root blob,  primary key(level, idx));

          CREATE TABLE docs_segments(  blockid INTEGER PRIMARY KEY,  block blob);

          sqlite>

        • #81505
          Kevin Kinnell
          Participant

            I don’t think he had it wrong, Charlie.

          • #81506
            Hai Nguyen
            Participant

              Hello,

              Yup, I learn the fts feature from https://www.sqlite.org/fts3.html#section_1_2 🙂 and like to try it out.

              I have no luck following Charlie’s and Kevin’s suggestion, I always use command “sqlite3” for SQLite.

              $ sqlite3 test.db

              SQLite version 3.6.4

              Enter “.help” for instructions

              Enter SQL statements terminated with a “;”

              sqlite> CREATE VIRTUAL TABLE docs USING fts3(title, body);

              SQL error: no such module: fts3

              sqlite> .q

              $ sqlite3 foo

              SQLite version 3.6.4

              Enter “.help” for instructions

              Enter SQL statements terminated with a “;”

              sqlite> create virtual table bar using fts3;

              SQL error: no such module: fts3

              sqlite> .q

              Max, I have SQLite version 3.6.4, which is embedded in our CLV 5.7. Don’t know why it works for Charlie on the same version with mine.

            • #81507
              Kevin Kinnell
              Participant

                Ah.  So you are logged in as a cloverleaf user on a unix-like system.  In that case, you should NOT use sqlite3.

                When you logged in with all of the setup associated with being a Cloverleaf user, you use sqlite to access Cloverleaf related SQLite stuff.  If you wanted to access your system’s sqlite shell, you’d probably use sqlite3 (or an absolute path.)

                ### ‘which’ shows the difference: I’m logged in as a Cloverleaf user ###

                $ which sqlite

                /opt/cloverleaf/cis6.0/integrator/tcl/bin/sqlite

                $ which sqlite3

                /usr/bin/sqlite3

                If you’re on RedHat, it’s very likely that the Cloverleaf SQLite is ahead of your system SQLite, possibly by as much as a version number!

              • #81508
                Hai Nguyen
                Participant

                  Thanks for quick response and suggestion Kevin.

                  I got the same error with both log-in sessions Unix and Cloverleaf user, and there is only “sqlite3” on both sessions.

                  ### Logged in as an Unix user:

                  $ which sqlite

                  which: no sqlite in (/bin:/usr/bin:/usr/ucb:/etc:/opt/sfw/bin:/hci:/hci/bin:/hci/kshlib:/usr/local/bin:.)

                  $ which sqlite3

                  /usr/bin/sqlite3

                  $ sqlite3 foo

                  SQLite version 3.3.6

                  Enter “.help” for instructions

                  sqlite> create virtual table bar using fts3;

                  SQL error: near “virtual”: syntax error

                  ### Logged in as a Cloverleaf user:

                  $ which sqlite

                  /usr/bin/which: no sqlite in (/hci/qdx5.7/integrator/…)

                  $ which sqlite3

                  /hci/qdx5.7/integrator/tcl/bin/sqlite3

                  $ sqlite3 foo

                  SQLite version 3.6.4

                  Enter “.help” for instructions

                  Enter SQL statements terminated with a “;”

                  sqlite> create virtual table bar using fts3;

                  SQL error: no such module: fts3

                  My Linux version is:

                  Red Hat Enterprise Linux Server release 5.9 (Tikanga)

                  Kernel 2.6.18-348.3.1.el5 on an x86_64

                • #81509
                  Kevin Kinnell
                  Participant

                    Okay, I’m flummoxed.  I wonder if the SQLite in cl 5.7 was compiled without fts3?  It’s a config switch to the compiler, and it’s not automatic.  fts3 has been there since SQLite 3.5, but I don’t know when it started being the default in Cloverleaf.

                    Max or Charlie?

                  • #81510
                    Charlie Bursell
                    Participant

                      What Cloverleaf version Hai?  We do not install sqlite under the /usr directory.

                      If I run: ‘which sqlite’ on my Linux box, I get

                      /hci/cis6.0/integrator/tcl/bin/sqlite

                      Check under $HCIROOT/tc/bin

                      As for when the fts was compiled in, I don’t know since I have never had a reason to use it.  I have versions back to 5.8 and it is there.  If you are still running 5.7 you are well overdue for an upgrade  ðŸ™‚

                    • #81511
                      Hai Nguyen
                      Participant

                        Only sqlite3 installed on my box:

                        $ which sqlite3

                        /hci/qdx5.7/integrator/tcl/bin/sqlite3

                        $ which sqlite

                        /usr/bin/which: no sqlite in (/hci/qdx5.7/integrator/…)

                        I have to wait until our current 5.7 upgrading to CLV version 6 then  ðŸ˜›

                        Thank you all for your help and check!

                    Viewing 8 reply threads
                    • The forum ‘Cloverleaf’ is closed to new topics and replies.