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.
- data/README.rdoc +11 -9
- data/dnif.gemspec +1 -1
- data/lib/dnif/search.rb +3 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -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
|
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
|
11
|
+
class User < ActiveRecord::Base
|
12
12
|
|
13
13
|
define_index do
|
14
|
-
field :
|
15
|
-
field :
|
16
|
-
attribute :
|
14
|
+
field :full_name
|
15
|
+
field :email
|
16
|
+
attribute :created_at, :type => :datetime
|
17
17
|
|
18
|
-
where ["
|
18
|
+
where ["active = ?", false]
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
self.
|
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
|
-
|
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
|
|
data/dnif.gemspec
CHANGED
data/lib/dnif/search.rb
CHANGED
@@ -3,9 +3,9 @@ module Dnif
|
|
3
3
|
def self.search(query, options = {})
|
4
4
|
options.reverse_merge!(:index => '*')
|
5
5
|
|
6
|
-
if
|
6
|
+
if options[:class]
|
7
7
|
filter_value = Dnif::MultiAttribute.encode(options[:class]).split(",").map(&:to_i)
|
8
|
-
client.filters
|
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
|
37
|
+
@client ||= Riddle::Client.new(address, port)
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.config_path
|