muck-services 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/muck/entries_controller.rb +23 -22
- data/locales/en.yml +1 -0
- data/muck-services.gemspec +2 -2
- data/test/rails_root/config/environment.rb +2 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.21
|
@@ -78,29 +78,30 @@ class Muck::EntriesController < ApplicationController
|
|
78
78
|
|
79
79
|
protected
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
81
|
+
def _search operator = :or
|
82
|
+
@page = (params[:page] || 1).to_i
|
83
|
+
@per_page = (params[:per_page] || 10).to_i
|
84
|
+
@offset = (@page-1)*@per_page
|
85
|
+
if !@search.nil?
|
86
|
+
@term_list = URI.escape(@search)
|
87
|
+
results = Entry.search(@search, @grain_size, I18n.locale.to_s, @per_page, @offset, operator)
|
88
|
+
@hit_count = results.total
|
89
|
+
@results = results.results
|
90
|
+
@paginated_results = @results.paginate(:page => @page, :per_page => @per_page, :total_entries => @hit_count)
|
91
|
+
log_query(current_user.nil? ? request.remote_addr : current_user.id, Language.locale_id, @tag_filter.nil? ? 'search' : 'browse', @search, @grain_size, @hit_count)
|
92
|
+
end
|
93
|
+
rescue RuntimeError, MuckServices::Exceptions::LanguageNotSupported => ex
|
94
|
+
@hit_count = 0
|
95
|
+
@results = []
|
96
|
+
flash[:error] = t('muck.services.search_problem') + '<p class="support-information">Information for support: <br />' + ex.to_s + '</p>'
|
92
97
|
end
|
93
|
-
rescue MuckServices::Exceptions::LanguageNotSupported => ex
|
94
|
-
@hit_count = 0
|
95
|
-
@results = []
|
96
|
-
flash[:error] = ex.to_s
|
97
|
-
end
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
def query_logger
|
100
|
+
@@query_logger ||= Logger.new("#{RAILS_ROOT}/log/queries_#{Date.today}.log")
|
101
|
+
end
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
103
|
+
def log_query(user_id, locale, search_type, query, grain_size, hits)
|
104
|
+
query_logger.info "#{Time.new.to_i},#{user_id},#{locale},#{search_type},\"#{query.gsub(/"/, '\\\\"')}\",#{grain_size},#{hits}"
|
105
|
+
end
|
106
|
+
|
106
107
|
end
|
data/locales/en.yml
CHANGED
@@ -211,6 +211,7 @@ en:
|
|
211
211
|
explore: "Search for {{topic}}"
|
212
212
|
language_not_supported: The requested language is not supported
|
213
213
|
get_recommendations: Get Recommendations
|
214
|
+
search_problem: "There was a problem with your search. Please review your search criteria and try again."
|
214
215
|
comment_entries_count:
|
215
216
|
one: "1 Comment"
|
216
217
|
other: "{{count}} Comments"
|
data/muck-services.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-services}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.21"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joel Duffin", "Justin Ball"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-11}
|
13
13
|
s.description = %q{This gem contains the rails specific code for dealing with feeds, aggregations and recommendations. It is meant to work with the muck-raker gem.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,8 @@ Rails::Initializer.run do |config|
|
|
27
27
|
config.gem "river"
|
28
28
|
config.gem "overlord"
|
29
29
|
config.gem "friendly_id"
|
30
|
+
config.gem "sanitize"
|
31
|
+
config.gem "geokit"
|
30
32
|
config.gem 'muck-engine', :lib => 'muck_engine'
|
31
33
|
config.gem 'muck-users', :lib => 'muck_users'
|
32
34
|
config.gem 'muck-comments', :lib => 'muck_comments'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Duffin
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-12-
|
13
|
+
date: 2009-12-11 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|