On Sun, Nov 6, 2022 at 11:39 PM Roman Turner <[email protected]>
wrote:

> Howdy,
>
> I have recently stumbled upon Sequel and I have been playing around with
> SQLite more. When I was attempting to create a simple full text search.
> Following the example <https://www.sqlite.org/fts5.html> in the SQLite
> documentation.
>
> FTS5 is a provided module that can implement full text search.
>
> ```ruby
> # I connected to the database
> DB = Sequel.connect('sqlite://test.db')
> #=> #<Sequel::SQLite::Database: "sqlite://test.db">
>
>
> # I attempted to run sql to set up the required virtual tables
> DB.run('CREATE VIRTUAL TABLE email USING fts5(sender, title,
> body');
> # Error received:
> #=> 
> /Users/romanturner/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb:152:in
> `initialize': SQLite3::SQLException: incomplete input
> (Sequel::DatabaseError)
>
> ```
>

This looks like bad SQL, missing the closing parenthesis.


> In the end my goal was achieved, but I was curious if there was a better
> way to achieve this. I would eventually like to tie this to a fly.io app
> and be able to spin up new instances and run migrations without issue.
>

According to https://www.sqlite.org/fts5.html, MATCH and = are equivalent.
So you could do:

emails.where(email: 'shunned').all

Or you could use the table valued function approach discussed:

DB.from{email('shunned')}.all

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSScUPqPbtR%3DZyKx889NP1hUCFt4nW_YHW2nhWyFb%2BBTJWw%40mail.gmail.com.

Reply via email to