Skip to content

Commit 6bbbe74

Browse files
committed
add an API endpoint for SOLR rebuilds
1 parent bfe18ea commit 6bbbe74

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

chef-server-api/app/controllers/search.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ def show
5252
"total" => total
5353
})
5454
end
55+
56+
def reindex
57+
Chef::Solr.new.rebuild_index
58+
end
5559

5660
end

chef-server-api/lib/chef-server-api.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def self.setup_router(scope)
118118

119119
# Search
120120
scope.resources :search
121+
scope.match('/search/reindex', :method => 'post').to(:controller => "search", :action => "reindex")
121122

122123
# Cookbooks
123124
scope.match('/nodes/:id/cookbooks', :method => 'get').to(:controller => "nodes", :action => "cookbooks")

0 commit comments

Comments
 (0)