xapian_db 0.5.10 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ##0.5.11 (April 21st, 2011)
2
+
3
+ Features:
4
+
5
+ - XapianDb.search accepts all options supported by XapianDb::Database.search
6
+ - Rails log entries include query execution time
7
+ - small changes to the beanstalk worker error handling
8
+
1
9
  ##0.5.10 (April 6th, 2011)
2
10
 
3
11
  Features:
@@ -23,8 +23,8 @@ module XapianDb
23
23
  Rails.logger.info "XapianDb beanstalk worker: ready"
24
24
 
25
25
  loop do
26
+ job = beanstalk.reserve
26
27
  begin
27
- job = beanstalk.reserve
28
28
  params = YAML::load job.body
29
29
  Rails.logger.info "XapianDb beanstalk worker: executing task #{params}"
30
30
  task = params.delete :task
@@ -32,13 +32,7 @@ module XapianDb
32
32
  rescue Exception => ex
33
33
  Rails.logger.error "XapianDb beanstalk worker: could not process #{job.body} (#{ex})"
34
34
  end
35
-
36
- begin
37
- job.delete
38
- rescue Exception => ex
39
- Rails.logger.error "XapianDb beanstalk worker: could delete job #{job.body} (#{ex})"
40
- end
41
-
35
+ job.delete
42
36
  end
43
37
  end
44
38
  end
@@ -65,7 +65,7 @@ module XapianDb
65
65
  # If we do not have a valid query we return an empty result set
66
66
  return Resultset.new(nil, opts) unless query
67
67
 
68
- Rails.logger.info "Executing XapianDb search: #{expression}" if defined?(Rails)
68
+ start = Time.now
69
69
 
70
70
  enquiry = Xapian::Enquire.new(reader)
71
71
  enquiry.query = query
@@ -84,7 +84,10 @@ module XapianDb
84
84
 
85
85
  opts[:spelling_suggestion] = @query_parser.spelling_suggestion
86
86
  opts[:db_size] = self.size
87
- Resultset.new(enquiry, opts)
87
+ result = Resultset.new(enquiry, opts)
88
+
89
+ Rails.logger.debug "XapianDb search (#{(Time.now - start) * 1000}ms) #{expression}" if defined?(Rails)
90
+ result
88
91
  end
89
92
 
90
93
  # A very simple implementation of facets limited to the class facets.
data/lib/xapian_db.rb CHANGED
@@ -74,8 +74,8 @@ module XapianDb
74
74
  # Query the configured database.
75
75
  # See {XapianDb::Database#search} for options
76
76
  # @return [XapianDb::Resultset]
77
- def self.search(expression)
78
- XapianDb::Config.database.search(expression)
77
+ def self.search(expression, options={})
78
+ XapianDb::Config.database.search(expression, options)
79
79
  end
80
80
 
81
81
  # Get facets from the configured database.
@@ -21,8 +21,8 @@ namespace :xapian_db do
21
21
  puts DEPRECATION_WARNING
22
22
  puts "XapianDb beanstalk worker is serving on #{url}..."
23
23
  loop do
24
+ job = beanstalk.reserve
24
25
  begin
25
- job = beanstalk.reserve
26
26
  params = YAML::load job.body
27
27
  Rails.logger.info "XapianDb beanstalk worker: executing task #{params}"
28
28
  task = params.delete :task
@@ -30,13 +30,7 @@ namespace :xapian_db do
30
30
  rescue Exception => ex
31
31
  Rails.logger.error "XapianDb beanstalk worker: could not process #{job.body} (#{ex})"
32
32
  end
33
-
34
- begin
35
- job.delete
36
- rescue Exception => ex
37
- Rails.logger.error "XapianDb beanstalk worker: could delete job #{job.body} (#{ex})"
38
- end
39
-
33
+ job.delete
40
34
  end
41
35
 
42
36
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 10
9
- version: 0.5.10
8
+ - 11
9
+ version: 0.5.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Gernot Kogler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-04-06 00:00:00 +02:00
17
+ date: 2011-04-21 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency