dnif 0.0.1.beta.1 → 0.0.1.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +11 -9
  2. data/dnif.gemspec +1 -1
  3. data/lib/dnif/search.rb +3 -3
  4. metadata +2 -2
@@ -2,24 +2,24 @@
2
2
 
3
3
  dnif is the new find... for sphinx
4
4
 
5
- dnif is a gem to index data using ActiveRecord finders, letting you index your custom methods and not only your table fields
5
+ dnif is a gem to index data using ActiveRecord finders (for now), letting you index custom methods and not only table columns
6
6
 
7
7
  == Usage
8
8
 
9
9
  require "dnif"
10
10
 
11
- class Post < ActiveRecord::Base
11
+ class User < ActiveRecord::Base
12
12
 
13
13
  define_index do
14
- field :title
15
- field :body
16
- attribute :published_at, :type => :datetime
14
+ field :full_name
15
+ field :email
16
+ attribute :created_at, :type => :datetime
17
17
 
18
- where ["draft = ?", false]
18
+ where ["active = ?", false]
19
19
  end
20
20
 
21
- def slug
22
- self.title.parameterize
21
+ def full_name
22
+ self.first_name + " " + self.last_name
23
23
  end
24
24
  end
25
25
 
@@ -27,7 +27,7 @@ dnif is a gem to index data using ActiveRecord finders, letting you index your c
27
27
  rake dnif:index
28
28
  rake dnif:start
29
29
 
30
- Post.search("dnif")
30
+ User.search("Rafael Souza")
31
31
 
32
32
  == TODO
33
33
 
@@ -36,6 +36,8 @@ dnif is a gem to index data using ActiveRecord finders, letting you index your c
36
36
  - Try to remove ActiveRecord dependency, making it work with others ORMs/ODMs/etc
37
37
  - Documentation
38
38
  - Improve test suite
39
+ - Index in chunks
40
+ - Support to delta index (or something like that)
39
41
 
40
42
  == Maintainer
41
43
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dnif}
8
- s.version = "0.0.1.beta.1"
8
+ s.version = "0.0.1.beta.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rafael Souza"]
@@ -3,9 +3,9 @@ module Dnif
3
3
  def self.search(query, options = {})
4
4
  options.reverse_merge!(:index => '*')
5
5
 
6
- if not options[:class].nil?
6
+ if options[:class]
7
7
  filter_value = Dnif::MultiAttribute.encode(options[:class]).split(",").map(&:to_i)
8
- client.filters << Riddle::Client::Filter.new("class_id", filter_value)
8
+ client.filters = [Riddle::Client::Filter.new("class_id", filter_value)]
9
9
  end
10
10
 
11
11
  results = client.query(query, options[:index])
@@ -34,7 +34,7 @@ module Dnif
34
34
  port = searchd["port"] || 3313
35
35
  end
36
36
 
37
- client = Riddle::Client.new(address, port)
37
+ @client ||= Riddle::Client.new(address, port)
38
38
  end
39
39
 
40
40
  def self.config_path
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 0
8
8
  - 1
9
9
  - beta
10
- - 1
11
- version: 0.0.1.beta.1
10
+ - 2
11
+ version: 0.0.1.beta.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Rafael Souza