Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Add search methods to couchrest_model gem
Ruby
tag: v0.0.1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
features
lib
spec
.document
.gitignore
.rspec
LICENSE
README.rdoc
Rakefile
VERSION
couchrest_model_search.gemspec

README.rdoc

couchrest_model_search

This add search method calls to couchrest_model gem. Assuming you are using couchdb-lucene.

Install

gem install couchrest_model_search

Usage

class Article < CouchRest::Model::Base
end

# save design doc to couchdb if you have existing one.
# by default, couchrest_model only update view_by functions.
Article.update_search_doc    

@articles = Article..search 'by_content', "apple"  # search by keyword apple

# you can also custom the search function.
class CustomArticle < CouchRest::Model::Base
  def self.fulltext
    { "by_content" => {"index" => %(function(doc) {})}
    }
  end
end
Something went wrong with that request. Please try again.