Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 59c300591f
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (35 sloc) 0.922 kb
module Hide
class Indexer
attr_reader :index
def initialize(index_name)
@site = Hide::Site.new(Hide.config(:path), :pages_directories => Hide.config(:directories))
@index = Slingshot.index index_name
end
def setup
index.create :mappings => Hide.config(:mappings)
end
def destroy!
index.delete
end
def reindex!
(@site.pages + @site.posts).each do |page|
next unless page.title
index_page page
end
index.refresh
end
def update! before, after
updater = Updater.new @site, before, after
updater.update_site
(updater.updated_pages + updater.updated_posts).each do |page|
next unless page.title
index_page page
end
index.refresh
end
def index_page(page)
p ['INDEXING', page.category, page.id]
p index.store( page.category.to_s, page)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.