Remove Algolia for ClassifiedListings (#6435) [deploy]
This commit is contained in:
parent
d95d78671f
commit
07d3991bc8
3 changed files with 0 additions and 23 deletions
|
|
@ -6,13 +6,11 @@ module ClassifiedListingsToolkit
|
|||
def unpublish_listing
|
||||
@classified_listing.published = false
|
||||
@classified_listing.save
|
||||
@classified_listing.remove_from_index!
|
||||
end
|
||||
|
||||
def publish_listing
|
||||
@classified_listing.published = true
|
||||
@classified_listing.save
|
||||
@classified_listing.index!
|
||||
end
|
||||
|
||||
def update_listing_details
|
||||
|
|
@ -29,7 +27,6 @@ module ClassifiedListingsToolkit
|
|||
def bump_listing_success
|
||||
@classified_listing.bumped_at = Time.current
|
||||
saved = @classified_listing.save
|
||||
@classified_listing.index! if saved
|
||||
saved
|
||||
end
|
||||
|
||||
|
|
@ -115,7 +112,6 @@ module ClassifiedListingsToolkit
|
|||
|
||||
if successful_transaction
|
||||
clear_listings_cache
|
||||
@classified_listing.index!
|
||||
process_successful_creation
|
||||
else
|
||||
@credits = current_user.credits.unspent
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class ClassifiedListing < ApplicationRecord
|
||||
include AlgoliaSearch
|
||||
include Searchable
|
||||
|
||||
SEARCH_SERIALIZER = Search::ClassifiedListingSerializer
|
||||
|
|
@ -43,23 +42,6 @@ class ClassifiedListing < ApplicationRecord
|
|||
validate :validate_tags
|
||||
validate :validate_category
|
||||
|
||||
algoliasearch per_environment: true do
|
||||
attribute :title, :processed_html, :bumped_at, :tag_list, :category, :id, :user_id, :slug, :contact_via_connect, :location, :expires_at
|
||||
attribute :author do
|
||||
{ username: author.username,
|
||||
name: author.name,
|
||||
profile_image_90: ProfileImage.new(author).get(width: 90) }
|
||||
end
|
||||
tags do
|
||||
[tag_list,
|
||||
"user_#{user_id}",
|
||||
"organization_#{organization_id}"]
|
||||
end
|
||||
attributesForFaceting [:category]
|
||||
customRanking ["desc(bumped_at)"]
|
||||
searchableAttributes %w[title processed_html tag_list slug location]
|
||||
end
|
||||
|
||||
scope :published, -> { where(published: true) }
|
||||
|
||||
def self.cost_by_category(category = "education")
|
||||
|
|
|
|||
|
|
@ -288,7 +288,6 @@ Rails.logger.info "12. Creating Classified listings"
|
|||
users = User.order(Arel.sql("RANDOM()")).to_a
|
||||
users.each { |user| Credit.add_to(user, rand(100)) }
|
||||
|
||||
ClassifiedListing.clear_index!
|
||||
listings_categories = ClassifiedListing.categories_available.keys
|
||||
listings_categories.each_with_index do |category, index|
|
||||
# rotate users if they are less than the categories
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue