Now that was almost too easy. Full-text search is working in the trunk
for both MySQL and PostgreSQL. Here's how to use it:

=== Creating a full-text index

  DB.create_table :posts do
    text :title
    text :body
    full_text_index [:title, :body]
  end

You can also add an index outside of #create_table:

  DB.add_full_text_index :posts, [:title, :body]

Or you can supply the full_text option to add_index:

  DB.add_index :posts, :body, :full_text => true

The PostgreSQL implementation also supports a language setting for the
index:

  DB.add_full_text_index :posts, :body, :language => 'french'

=== Full-text searching

The new Dataset#full_text_search returns a filtered dataset:

  DB[:posts].full_text_search(:body, 'sequel')

You can also search on multiple columns:

  DB[:posts].full_text_search([:title, :body], 'sequel')

Or multiple terms:

  DB[:posts].full_text_search([:title, :body], ['ruby', 'sequel'])

The MySQL implementation has a boolean mode:

  DB[:posts].full_text_search(:body, '+sequel -activerecord', :boolean
=> true)

The PostgreSQL implementation accepts a language option:

  DB[:posts].full_text_search(:body, 'sequel', :language => 'french)

And that's about it! Still missing is the ability to order by rank,
and maybe some other stuff, but that will also come soon.

sharon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to