Skip to content

phuwanart/thbrk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thbrk

Gem Thai Word Break for use with Thinking Sphinx.

Install dependency: libthai & libthai4r

Can do follow this https://github.com/phuwanart/libthai4r

Gemfile

gem 'thbrk'

Quick Start

In your model:

class Article < ActiveRecord::Base
  thbrk # include when use plugin
  define_thai_columns :title, :body # include when use plugin
end

In index file:

# app/indices/article_index.rb
ThinkingSphinx::Index.define :article, with: :real_time do
  indexes title, sortable: true
  indexes body
  indexes thbrk # include when use plugin
end

In your migrations:

class AddThbrkColumnToArticle < ActiveRecord::Migration
  def change
    add_column :articles, :thbrk, :text
  end
end

In your 'config/thinking_sphinx.yml'

development:
  charset_table: "0..9, A..Z->a..z, _, a..z, U+E00..U+E7F"

Usage

# params[:q] is parameter from view
@articles = Article.search(params[:q].to_s.to_thbrk)

License

Copyright © 2011 Phuwanart Larpmark, released under the MIT license

About

Thai Word Break for use with Thinking Sphinx

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages