seasyar 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ seasyar
2
+ =======
3
+
4
+ Seasyar is an active record implementation for seasy. It has two parts: an active record implementation of the storage interface of seasy and a way to make it easy to use with an active record model regardless of what storage you use.
5
+
6
+
7
+ Use seasyar in your rails model classes
8
+ ---------------------------------------
9
+
10
+ Say you have a person class with the fields first_name, last_name and phone_number. To add search to this put the following somewhere in your class:
11
+
12
+ include Seasyar
13
+
14
+ after_save do
15
+ index index_name, :first_name, :last_name, :phone_number
16
+ end
17
+
18
+ before_destroy do
19
+ unindex index_name
20
+ end
21
+
22
+ and seasyar will use the configured seasy storage to update the named index.
23
+
24
+
25
+ Searching
26
+ ---------
27
+
28
+ Seasyar also adds a convenience method for searching:
29
+
30
+ include Seasyar
31
+
32
+ search index_name, query
33
+
34
+ but it is of course possible to use seasy directly also.
35
+
36
+
37
+ Storing the index with active record
38
+ ------------------------------------
39
+
40
+ You need to configure seasy to use the active record storage in seasyar. Put this in an initiliazer of before your code.
41
+
42
+ Seasy.configure do |config|
43
+ config.storage = ActiveRecordStorage
44
+ end
45
+
46
+ You can use another storage implementation and still use sesyar for easy integration with seasy in your model classes.
47
+
48
+ You also need to put the following migration somewhere in your code (might build a generator for this....):
49
+
50
+ create_table "seasy_data", :force => true do |t|
51
+ t.string "key"
52
+ t.string "target"
53
+ t.integer "weight"
54
+ t.datetime "created_at"
55
+ t.datetime "updated_at"
56
+ t.string "source"
57
+ t.string "index_name"
58
+ end
59
+
60
+
61
+ Copyright
62
+ ---------
63
+
64
+ Copyright (c) 2011 Fredrik Rubensson. See LICENSE.txt for
65
+ further details.
66
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
@@ -17,15 +17,14 @@ module Seasyar
17
17
  old = SeasyData.find_all_by_source source
18
18
  old.each { |data| data.delete }
19
19
 
20
- weights.keys.each do |k|
21
- i = Seasyar::SeasyData.new
22
- i.key = k
23
- i.target = target
24
- i.source = source
25
- i.weight = weights[k]
26
- i.index_name = @name
27
- i.save!
20
+ hash_for_create = weights.keys.map do |k|
21
+ { :key => k,
22
+ :target => target,
23
+ :source => source,
24
+ :weight => weights[k],
25
+ :index_name => @name }
28
26
  end
27
+ Seasyar::SeasyData.create hash_for_create
29
28
  end
30
29
 
31
30
  def search question
data/seasyar.gemspec CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "seasyar"
8
- s.version = "0.0.10"
8
+ s.version = "0.0.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Fredrik Rubensson"]
12
- s.date = "2012-01-20"
12
+ s.date = "2012-09-10"
13
13
  s.description = "Seasy integration. Active record storage for seasy and save hooks in models."
14
14
  s.email = "fredrik@eldfluga.se"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -22,11 +22,10 @@ Gem::Specification.new do |s|
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.md",
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "db/config.yml",
29
- "db/development.sqlite3",
30
29
  "db/migrate/20110906072000_create_index.rb",
31
30
  "db/migrate/20110926212900_add_source.rb",
32
31
  "db/migrate/20111116164500_add_index_name.rb",
@@ -42,7 +41,7 @@ Gem::Specification.new do |s|
42
41
  s.homepage = "http://github.com/froderik/seasyar"
43
42
  s.licenses = ["MIT"]
44
43
  s.require_paths = ["lib"]
45
- s.rubygems_version = "1.8.10"
44
+ s.rubygems_version = "1.8.24"
46
45
  s.summary = "active record integration for seasy"
47
46
 
48
47
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: seasyar
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Fredrik Rubensson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-01-20 00:00:00 Z
13
+ date: 2012-09-10 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: seasy
@@ -119,18 +119,17 @@ extensions: []
119
119
 
120
120
  extra_rdoc_files:
121
121
  - LICENSE.txt
122
- - README.rdoc
122
+ - README.md
123
123
  files:
124
124
  - .document
125
125
  - .rvmrc
126
126
  - Gemfile
127
127
  - Gemfile.lock
128
128
  - LICENSE.txt
129
- - README.rdoc
129
+ - README.md
130
130
  - Rakefile
131
131
  - VERSION
132
132
  - db/config.yml
133
- - db/development.sqlite3
134
133
  - db/migrate/20110906072000_create_index.rb
135
134
  - db/migrate/20110926212900_add_source.rb
136
135
  - db/migrate/20111116164500_add_index_name.rb
@@ -155,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
154
  requirements:
156
155
  - - ">="
157
156
  - !ruby/object:Gem::Version
158
- hash: -646363705184731964
157
+ hash: 1935996492776390587
159
158
  segments:
160
159
  - 0
161
160
  version: "0"
@@ -168,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
167
  requirements: []
169
168
 
170
169
  rubyforge_project:
171
- rubygems_version: 1.8.10
170
+ rubygems_version: 1.8.24
172
171
  signing_key:
173
172
  specification_version: 3
174
173
  summary: active record integration for seasy
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = arseasy
2
-
3
- Description goes here.
4
-
5
- == Contributing to arseasy
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
- * Fork the project
10
- * Start a feature/bugfix branch
11
- * Commit and push until you are happy with your contribution
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2011 Fredrik Rubensson. See LICENSE.txt for
18
- further details.
19
-
Binary file