Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Strip out solr usage

This is to replace solr with a simpler postgres-based search system
to reduce costs, which will allow me to improve the performance of
other parts of the site
  • Loading branch information...
commit 72ff26d606cdf59029d2ca4e15432a1f4a845968 1 parent eb1aa98
@robotmay authored
View
4 Gemfile
@@ -36,10 +36,6 @@ gem 'pg'
# search
gem 'pg_search'
gem 'pg_array_parser'
-gem 'sunspot_rails'
-gem 'sunspot_solr'
-gem 'sunspot-queue', github: 'robotmay/sunspot-queue'
-gem 'sunspot_with_kaminari'
# redis
gem 'redis-objects'
View
26 Gemfile.lock
@@ -7,13 +7,6 @@ GIT
omniauth-oauth2
GIT
- remote: git://github.com/robotmay/sunspot-queue.git
- revision: 32e922edb103a867507e7935065d90ebec2278de
- specs:
- sunspot-queue (0.10.0)
- sunspot_rails (>= 1.3.0)
-
-GIT
remote: git://github.com/sporkrb/spork-rails.git
revision: 0dd45e59d3237b4c8f9efc215b46d9c07072a95e
specs:
@@ -265,7 +258,6 @@ GEM
postmark-rails (0.6.0)
actionmailer (>= 3.0.0)
postmark (~> 1.1.0)
- pr_geohash (1.0.0)
proxies (0.2.1)
pry (0.9.12.6)
coderay (~> 1.0)
@@ -315,8 +307,6 @@ GEM
redis (>= 3.0.2)
rest-client (1.6.7)
mime-types (>= 1.16)
- rsolr (1.0.9)
- builder (>= 2.1.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
@@ -393,18 +383,6 @@ GEM
json (~> 1.8.1)
mime-types (~> 1.25)
rest-client (~> 1.4)
- sunspot (2.1.0)
- pr_geohash (~> 1.0)
- rsolr (~> 1.0.7)
- sunspot_rails (2.1.0)
- nokogiri
- rails (>= 3)
- sunspot (= 2.1.0)
- sunspot_solr (2.1.0)
- sunspot_with_kaminari (0.2.0)
- kaminari (>= 0.14.0)
- sunspot
- sunspot_rails
temple (0.6.7)
term-ansicolor (1.3.0)
tins (~> 1.0)
@@ -509,10 +487,6 @@ DEPENDENCIES
slim (>= 1.3.0)
spork-rails!
stripe
- sunspot-queue!
- sunspot_rails
- sunspot_solr
- sunspot_with_kaminari
thread
timecop
turbolinks
View
2  app/controllers/photographs_controller.rb
@@ -100,6 +100,8 @@ def seeking_feedback
end
def search
+ redirect_to photographs_path
+
if search_params[:q].blank? && search_params[:keyword].blank?
redirect_to(photographs_path) and return
end
View
30 app/models/photograph.rb
@@ -106,36 +106,6 @@ class Photograph < ActiveRecord::Base
scope :for_month, -> (date_range) {
where(created_at: date_range)
}
-
- searchable do
- text :title do |photo|
- photo.metadata.title
- end
-
- text :description do |photo|
- photo.metadata.description
- end
-
- string :keywords, multiple: true do |photo|
- photo.metadata.keywords
- end
-
- text :creator_name do |photo|
- photo.user.name
- end
-
- integer :user_id, references: User
- integer :license_id, references: License
- integer :category_id, references: Category
- integer :collection_ids, references: Collection, multiple: true do |photo|
- photo.collections.pluck(:id)
- end
- float :score
- time :created_at
- boolean :public, using: :public?
- boolean :safe_for_work
- boolean :ghost
- end
def favourites_count
super || 0
View
12 app/views/shared/_anon_nav.html.slim
@@ -32,18 +32,6 @@ nav id="layout-nav" class="top-bar"
div class="row"
div class="large-12 columns"
- label= t("nav.search")
- = form_tag search_photographs_path, method: :get do
- div class="row collapse"
- div class="small-8 columns"
- = text_field_tag :q, params[:q]
-
- div class="small-4 columns"
- = submit_tag t("nav.search"), class: "button secondary"
- .clear
-
- div class="row"
- div class="large-12 columns"
label= t("nav.categories")
div class="row"
View
12 app/views/shared/_nav.html.slim
@@ -32,18 +32,6 @@ nav id="layout-nav" class="top-bar"
div class="row"
div class="large-12 columns"
- label= t("nav.search")
- = form_tag search_photographs_path, method: :get do
- div class="row collapse"
- div class="small-8 columns"
- = text_field_tag :q, params[:q]
-
- div class="small-4 columns"
- = submit_tag t("nav.search"), class: "button secondary"
- .clear
-
- div class="row"
- div class="large-12 columns"
label= t("nav.categories")
div class="row"
View
3  config/initializers/sunspot.rb
@@ -1,3 +0,0 @@
-require "sunspot/queue/sidekiq"
-backend = Sunspot::Queue::Sidekiq::Backend.new
-Sunspot.session = Sunspot::Queue::SessionProxy.new(Sunspot.session, backend)
Please sign in to comment.
Something went wrong with that request. Please try again.