solrsan 0.0.33 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,22 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- solrsan (0.0.32)
5
- activemodel (~> 3.0.5)
6
- activesupport (~> 3.0.5)
7
- rsolr (~> 1.0.0)
4
+ solrsan (0.0.33)
5
+ activemodel (~> 3.1.1)
6
+ activesupport (~> 3.1.1)
7
+ rsolr (~> 1.0.3)
8
8
 
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- activemodel (3.0.7)
13
- activesupport (= 3.0.7)
14
- builder (~> 2.1.2)
15
- i18n (~> 0.5.0)
16
- activesupport (3.0.7)
17
- builder (2.1.2)
18
- i18n (0.5.0)
19
- rsolr (1.0.0)
12
+ activemodel (3.1.1)
13
+ activesupport (= 3.1.1)
14
+ builder (~> 3.0.0)
15
+ i18n (~> 0.6)
16
+ activesupport (3.1.1)
17
+ multi_json (~> 1.0)
18
+ builder (3.0.0)
19
+ i18n (0.6.0)
20
+ multi_json (1.0.3)
21
+ rsolr (1.0.3)
22
+ builder (= 3.0.0)
20
23
  builder (>= 2.1.2)
21
24
 
22
25
  PLATFORMS
@@ -1,4 +1,4 @@
1
- = solrsan
1
+ # solrsan
2
2
 
3
3
  http://github.com/tc/solrsan
4
4
 
@@ -9,71 +9,91 @@ Before you start, read the documentation for solr at http://wiki.apache.org/solr
9
9
  It'll be invaluable for knowing parameters and error messages.
10
10
  I made a few test cases for further examples at http://github.com/tc/solrsan/tree/master/test/unit
11
11
 
12
- === HOWTO
12
+ ## HOWTO
13
13
  Install Jetty
14
14
 
15
- wget http://download.eclipse.org/jetty/stable-7/dist/jetty-distribution-7.3.0.v20110203.tar.gz
15
+ ```
16
+ wget http://download.eclipse.org/jetty/stable-7/dist/jetty-distribution-7.5.3.v20111011.tar.gz
16
17
  tar -zxvf jetty-distribution-*.tar.gz
17
18
  rm jetty-distribution-*.tar.gz
18
- mv jetty-distribution-* /usr/local
19
- ln -s jetty-distribution-* jetty
19
+ sudo mv jetty-distribution-* /usr/local
20
+ cd /usr/local
21
+ sudo ln -s jetty-distribution-* jetty
22
+ ```
20
23
 
21
24
  Install solr
22
25
 
23
-
24
- wget http://www.ecoficial.com/apachemirror/lucene/solr/3.1.0/apache-solr-3.1.0.tgz
26
+ ```
27
+ wget http://www.ecoficial.com/apachemirror/lucene/solr/3.4.0/apache-solr-3.4.0.tgz
25
28
  tar -zxvf apache-solr-*.tgz
26
29
  cd apache-solr-*
27
- cp dist/apache-solr-*.war /usr/local/jetty/webapps/solr.war
30
+ sudo cp dist/apache-solr-*.war /usr/local/jetty/webapps/solr.war
31
+ ```
28
32
 
29
33
  Add solrsan to your Ruby application's Gemfile:
34
+
35
+ ```
30
36
  gem "solrsan"
37
+ ```
31
38
 
32
39
  Create solr configuration files using:
40
+
41
+ ```
33
42
  rails generate solrsan:config
43
+ ```
34
44
 
35
45
  The generator will copy the following files into your application.
36
46
 
47
+ ```
37
48
  config/solr.yml
38
49
  config/solr
39
50
  config/initializers/solrsan.rb
40
51
  lib/tasks/solr.rake
52
+ ```
41
53
 
42
54
  Edit the config/solr.yml for your directory paths.
43
55
 
44
56
  The rake file will add these rake tasks:
45
57
 
58
+ ```
46
59
  rake solr:start
47
60
  rake solr:stop
48
61
  rake solr:clear_index
49
62
  rake solr:index
63
+ ```
50
64
 
51
65
  you will need to alter clear_index/index to match your models
52
66
 
53
67
  Deploy tasks via capistrano:
54
68
  add to your deploy.rb
55
69
 
70
+ ```
56
71
  require 'solrsan/capistrano'
72
+ ```
57
73
 
58
74
  This will add the following methods which will just call the
59
75
  corresponding rake tasks:
60
76
 
77
+ ```
61
78
  cap solr:start
62
79
  cap solr:stop
63
80
  cap solr:reindex
81
+ ```
64
82
 
65
- === Indexing documents:
83
+ ## Indexing documents:
66
84
  Edit config/solr/conf/schema.xml to state the types of fields you want
67
85
  to index. You can use dynamic fields as well.
68
86
 
69
87
  These fields are required for each solr document and are automatically
70
88
  generated:
71
89
 
90
+ ```
72
91
  id, db_id, type
92
+ ```
73
93
 
74
94
  In your model, define as_solr_document and return a hash with specific fields.
75
95
 
76
-
96
+ ```
77
97
  class Document < ActiveRecord::Base
78
98
  include Solrsan::Search
79
99
  after_save :index
@@ -83,20 +103,30 @@ In your model, define as_solr_document and return a hash with specific fields.
83
103
  {:content => "hi"}
84
104
  end
85
105
  end
86
-
106
+ ```
87
107
 
88
108
  In each model, you can include a Solrsan::Search module which will include a few interface helper methods:
109
+
110
+ ```
89
111
  index
90
112
  destroy_index_document
91
113
  search(params)
114
+ ```
92
115
 
93
116
  === Search:
94
117
  A simple search query:
118
+
119
+ ```
95
120
  Document.search(:q => "hello world")
121
+ ```
96
122
 
97
123
  More searching examples can be seen in test/unit/search_test.rb
98
124
 
99
- == Changelog
125
+ ## Changelog
126
+
127
+ 0.5.0
128
+ Updated gems to rsolr 1.0.3/rails 3.1.1
129
+
100
130
  0.0.33
101
131
  Reverted Hashwithindifferentaccess for request parsing, buggy with will_paginate.
102
132
 
@@ -109,7 +139,7 @@ Usable version!
109
139
  0.0.1
110
140
  First release.
111
141
 
112
- == Copyright
142
+ ## Copyright
113
143
 
114
144
  Copyright (c) 2011 Tommy Chheng. See LICENSE for details.
115
145
 
@@ -1,10 +1,10 @@
1
1
  development:
2
2
  jetty_path: "/usr/local/jetty"
3
- solr_data_dir: "/Users/HOME_DIR/src/app_name/solr-data"
3
+ solr_data_dir: "<%= Rails.root %>/solr-data"
4
4
  solr_server_url: "http://localhost:9090/solr"
5
5
  test:
6
6
  jetty_path: "/usr/local/jetty"
7
- solr_data_dir: "/Users/HOME_DIR/src/app_name/solr-data"
7
+ solr_data_dir: "<%= Rails.root %>/solr-data"
8
8
  solr_server_url: "http://localhost:9090/solr"
9
9
  production:
10
10
  jetty_path: "/usr/local/jetty"
@@ -30,7 +30,7 @@ module Solrsan
30
30
  rescue RSolr::Error::Http => e
31
31
  {:docs => [],
32
32
  :metadata =>
33
- {:error => {:http_status_code => e.response[:status],
33
+ {:error => {:http_status_code => e.response[:status],
34
34
  :http_message_status => RSolr::Error::Http::STATUS_CODES[e.response[:status].to_i],
35
35
  :full_message => e.message}}}
36
36
  end
@@ -166,11 +166,6 @@ module Solrsan
166
166
 
167
167
  search_response[:docs] = highlighted_docs
168
168
 
169
- search_response[:docs].extend RSolr::Pagination::PaginatedDocSet
170
- search_response[:docs].per_page = per_page
171
- search_response[:docs].start = start
172
- search_response[:docs].total = total
173
-
174
169
  search_response
175
170
  end
176
171
 
@@ -1,3 +1,3 @@
1
1
  module Solrsan
2
- VERSION = "0.0.33"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/tasks/solr.rake CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'uri'
2
+ require 'erb'
2
3
  require 'yaml'
3
4
 
4
5
  namespace :solr do
@@ -10,7 +11,7 @@ namespace :solr do
10
11
  base_dir = Rails.root
11
12
  end
12
13
 
13
- solr_config = YAML::load( File.open( File.join(base_dir, "config", "solr.yml") ) )
14
+ solr_config = YAML::load(ERB.new(IO.read(File.join(base_dir, 'config', 'solr.yml'))).result)
14
15
  solr_home = File.join(base_dir, "config", "solr")
15
16
  solr_data_dir = solr_config[env]['solr_data_dir']
16
17
  solr_server_url = solr_config[env]['solr_server_url']
@@ -18,11 +19,11 @@ namespace :solr do
18
19
  jetty_port = URI.parse(solr_server_url).port
19
20
  jetty_path = solr_config[env]['jetty_path']
20
21
 
21
- solr_server_dir = "cd #{jetty_path};"
22
+ solr_server_dir = "cd \"#{jetty_path}\";"
22
23
  start_solr_cmd = "java -jar start.jar"
23
24
  logging_xml = "etc/jetty-logging.xml"
24
25
  jetty_port_opt = "jetty.port=#{jetty_port}"
25
- solr_params = "#{jetty_port_opt} -Dsolr.solr.home=#{solr_home} -Dsolr.data.dir=#{solr_data_dir}"
26
+ solr_params = "#{jetty_port_opt} -Dsolr.solr.home=\"#{solr_home}\" -Dsolr.data.dir=\"#{solr_data_dir}\""
26
27
 
27
28
  desc "Start solr"
28
29
  task(:start) do
data/solrsan.gemspec CHANGED
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Lightweight wrapper for using Apache Solr within a Ruby application including Rails and Sinatra.}
13
13
  s.description = %q{solrsan is a lightweight wrapper for using Apache Solr within a Ruby application including Rails and Sinatra.}
14
14
 
15
- s.add_dependency('rsolr', '~>1.0.0')
16
- s.add_dependency('activemodel', '~>3.0.5')
17
- s.add_dependency('activesupport', '~>3.0.5')
18
-
15
+ s.add_dependency('rsolr', '~>1.0.3')
16
+ s.add_dependency('activemodel', '~>3.1.1')
17
+ s.add_dependency('activesupport', '~>3.1.1')
18
+
19
19
  s.rubyforge_project = "solrsan"
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrsan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,42 +9,41 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-05 00:00:00.000000000 -07:00
13
- default_executable:
12
+ date: 2011-11-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rsolr
17
- requirement: &2153466800 !ruby/object:Gem::Requirement
16
+ requirement: &70127777711700 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
21
20
  - !ruby/object:Gem::Version
22
- version: 1.0.0
21
+ version: 1.0.3
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2153466800
24
+ version_requirements: *70127777711700
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: activemodel
28
- requirement: &2153466300 !ruby/object:Gem::Requirement
27
+ requirement: &70127777711200 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ~>
32
31
  - !ruby/object:Gem::Version
33
- version: 3.0.5
32
+ version: 3.1.1
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2153466300
35
+ version_requirements: *70127777711200
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: activesupport
39
- requirement: &2153465840 !ruby/object:Gem::Requirement
38
+ requirement: &70127777710700 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ~>
43
42
  - !ruby/object:Gem::Version
44
- version: 3.0.5
43
+ version: 3.1.1
45
44
  type: :runtime
46
45
  prerelease: false
47
- version_requirements: *2153465840
46
+ version_requirements: *70127777710700
48
47
  description: solrsan is a lightweight wrapper for using Apache Solr within a Ruby
49
48
  application including Rails and Sinatra.
50
49
  email:
@@ -57,7 +56,7 @@ files:
57
56
  - Gemfile
58
57
  - Gemfile.lock
59
58
  - LICENSE
60
- - README.rdoc
59
+ - README.md
61
60
  - Rakefile
62
61
  - config/solr.yml
63
62
  - config/solr.yml.example
@@ -90,7 +89,6 @@ files:
90
89
  - test/test_helper.rb
91
90
  - test/unit/indexer_test.rb
92
91
  - test/unit/search_test.rb
93
- has_rdoc: true
94
92
  homepage: http://github.com/tc/solrsan
95
93
  licenses: []
96
94
  post_install_message:
@@ -111,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
109
  version: '0'
112
110
  requirements: []
113
111
  rubyforge_project: solrsan
114
- rubygems_version: 1.6.2
112
+ rubygems_version: 1.8.10
115
113
  signing_key:
116
114
  specification_version: 3
117
115
  summary: Lightweight wrapper for using Apache Solr within a Ruby application including