Skip to content
Browse files

I've had it with DataMapper.

  • Loading branch information...
1 parent 15969a7 commit a050846856c4321d5bd17d04e9b83e048cbb6aa8 @shanna committed
Showing with 2 additions and 151 deletions.
  1. +2 −151 README.rdoc
View
153 README.rdoc
@@ -1,156 +1,7 @@
= DataMapper Sphinx Adapter
-* http://github.com/shanna/dm-sphinx-adapter/tree/master
+* http://github.com/shanna/dm-sphinx-adapter
== Description
-A DataMapper Sphinx adapter.
-
-== Dependencies
-
-Ruby::
-* dm-core ~> 1.0.0
-* dm-is-searchable ~> 0.9.7 (optional)
-* riddle ~> 1.0.9
-
-I'd recommend using the dm-more plugin dm-is-searchable instead of fetching the document id's yourself.
-
-== Install
-
-* Via git: git clone git://github.com/shanna/dm-sphinx-adapter.git
-* Via gem: gem install dm-sphinx-adapter
-
-== Synopsis
-
-DataMapper uses URIs or a connection has to connect to your data-stores. In this case the sphinx search daemon
-<tt>searchd</tt>.
-
-On its own this adapter will only return partial models. The DataMapper library <tt>dm-is-searchable</tt> however
-provides a common interface to search one adapter and load documents from another. My preference is to use this adapter
-in tandem with <tt>dm-is-searchable</tt>. See further examples in the synopsis for usage with <tt>dm-is-searchable</tt>.
-
-Like all DataMapper adapters you can connect with a Hash or URI.
-
-A URI:
- DataMapper.setup(:search, 'sphinx://localhost:9312')
-
-The breakdown is:
- "#{adapter}://#{host}:#{port}/#{config}"
- - adapter Must be :sphinx
- - host Hostname (default: localhost)
- - port Optional port number (default: 9312)
-
-Alternatively supply a Hash:
- DataMapper.setup(:search, {
- adapter: 'sphinx', # required
- host: 'localhost', # optional. Default: localhost
- port: 9312 # optional. Default: 9312
- })
-
-=== DataMapper
-
- require 'dm-sphinx-adapter'
-
- DataMapper.setup(:default, 'sqlite3::memory:')
- DataMapper.setup(:search, 'sphinx://localhost:9312')
-
- class Item
- include DataMapper::Resource
- property :id, Serial
- property :name, String
- end
-
- # Fire up your sphinx search daemon and start searching.
- docs = repository(:search){ Item.all(name: 'barney')} # Search 'items' index for '@name barney'
- items = Item.all(id: docs.map(&:id)) # Search :default for all the document id's returned by sphinx.
-
-=== DataMapper and IsSearchable
-
-IsSearchable is a DataMapper plugin that provides a common search interface when searching from one adapter and reading
-documents from another.
-
-IsSearchable will read resources from your <tt>:default</tt> repository on behalf of a search adapter such as
-<tt>dm-sphinx-adapter</tt> and <tt>dm-ferret-adapter</tt>. This saves some of the grunt work (as shown in the previous
-example) by mapping the resulting document id's from a search with your <tt>:search</tt> adapter into a suitable
-<tt>#first</tt> or <tt>#all</tt> query for your <tt>:default</tt> repository.
-
-IsSearchable adds a single class method to your resource. The first argument is a <tt>Hash</tt> of
-<tt>DataMapper::Query</tt> conditions to pass to your search adapter (in this case <tt>dm-sphinx-adapter</tt>). An
-optional second <tt>Hash</tt> of <tt>DataMapper::Query</tt> conditions can also be passed and will be appended to the
-query on your <tt>:default</tt> database. This can be handy if you need to add extra exclusions that aren't possible
-using <tt>dm-sphinx-adapter</tt> such as <tt>#gt</tt> or <tt>#lt</tt> conditions.
-
- require 'dm-core'
- require 'dm-is-searchable'
- require 'dm-sphinx-adapter'
-
- # Connections.
- DataMapper.setup(:default, 'sqlite3::memory:')
- DataMapper.setup(:search, 'sphinx://localhost:9312')
-
- class Item
- include DataMapper::Resource
- property :id, Serial
- property :name, String
-
- is :searchable # defaults to :search repository though you can be explicit:
- # is :searchable, repository: :sphinx
- end
-
- # Fire up your sphinx search daemon and start searching.
- items = Item.search(name: 'barney') # Search 'items' index for '@name barney'
-
-== Changes for dm-core >= 1.0 (dm-sphinx-adapter >= 0.9)
-
-=== Operators
-
-The DataMapper query symbol operator scheme now supports position, phrase, proximity, quorum and exact Sphinx query
-operators.
-
- # @subject[50] "hello world"
- Item.all(:subject.position => ['hello world', 50])
-
- # @subject "hello world"
- Item.all(:subject.phrase => 'hello world')
-
- # @subject "hello world"~10
- Item.all(:subject.proximity => ['hello world', 10])
-
- # @subject "hello world"/10
- Item.all(:subject.quorum => ['hello world', 10])
-
- # @subject ="hello world"
- Item.all(:subject.exact => 'hello world')
-
-=== Filters
-
-Sphinx query filters are now passed as a separate explicit set of conditions to the DataMapper query constructor.
-
- Item.all(name: 'barney', filter: {age: 50})
-
-==== Modes
-
-Sphinx query search modes including :extended2 (default), :all, :any, :phrase and :boolean are now supported if you
-need them.
-
- Item.all(name: %w{barney fred}, mode: :any)
-
-== Sphinx Configuration
-
-No limitations, restrictions or requirement are imposed on your sphinx configuration. The adapter will not generate nor
-overwrite your finely crafted config file.
-
-== Searchd
-
-Following the Unix mantra of doing one thing and doing it will this adapter does not manage your sphinx server.
-Try one of these fine offerings:
-
-* bluepill[http://github.com/arya/bluepill]
-* daemon_controller[http://github.com/FooBarWidget/daemon_controller]
-* monit[http://www.tildeslash.com/monit]
-
-== Contributing
-
-In short, go nuts! There is no style guide and I do not care if you write tests or comment code. If you write something
-neat just send me a pull request, tweet, email or yell at me in the street.
-
+An abandoned DataMapper Sphinx adapter.

0 comments on commit a050846

Please sign in to comment.
Something went wrong with that request. Please try again.