Class: ChefServerSlice::Search

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/search.rb

Instance Method Summary collapse

Methods inherited from Application

#absolute_slice_url, #access_denied, #authorized_node, #escape_node_id, #expand_cookbook_deps, #fix_up_node_id, #get_available_recipes, #load_all_files, #load_cookbook_segment, #login_required, #redirect_back_or_default, #segment_files, #specific_cookbooks, #store_location

Instance Method Details

#destroyObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/search.rb', line 44

def destroy
  @s = Chef::Search.new
  @entries = @s.search(params[:id], "*")
  @entries.each do |entry|
    Chef::Queue.send_msg(:queue, :remove, entry)
  end
  @status = 202
  if content_type == :html
    redirect url(:search)
  else
    display @entries
  end
end

#indexObject



28
29
30
31
32
# File 'app/controllers/search.rb', line 28

def index
  @s = Chef::Search.new
  @search_indexes = @s.list_indexes
  display @search_indexes
end

#showObject



34
35
36
37
38
39
40
41
42
# File 'app/controllers/search.rb', line 34

def show
  @s = Chef::Search.new
  
  query = params[:q].nil? ? "*" : (params[:q].empty? ? "*" : params[:q])
  attributes = params[:a].nil? ? [] : params[:a].split(",").collect { |a| a.to_sym }
  @results = @s.search(params[:id], query, attributes)
  
  display @results
end