Skip to content

Commit

Permalink
Update all search indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Feb 22, 2019
1 parent 8c8d0bd commit b70576d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions PowerTools/PowerToolsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ private function getPHPInfo()
}

/**
* Rebuild the search index
* Rebuild the search indexes
* @return \Illuminate\Http\RedirectResponse
*/
public function rebuildSearchIndex()
public function rebuildSearchIndexes()
{
return $this->doThing(
function () { Artisan::call('search:update'); },
'Search index rebuilt successfully',
'Problem rebuilding your search index'
function () {
Search::indexes()->each(function ($index, $key) {
Search::update($key);
});
},
'Search indexes rebuilt successfully',
'Problem rebuilding your search indexes'
);
}

Expand Down
4 changes: 2 additions & 2 deletions PowerTools/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: PowerTools
version: 1.6.4
description: Rebuild your search index, cache & asset presets, see your PHP Info and your log
version: 1.6.5
description: Rebuild your search indexes, cache & asset presets, see your PHP Info and your log
url: https://github.com/edalzell/statamic-powertools
developer: Erin Dalzell
developer_url: https://github.com/edalzell
2 changes: 1 addition & 1 deletion PowerTools/resources/views/widget.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="form-group text-fieldtype width-100">
<div class="field-inner">
<label class="block">Search</label>
<a href="{{ route('powertools.rebuild-search') }}" class="btn">Update Search Index</a>
<a href="{{ route('powertools.rebuild-search') }}" class="btn">Update Search Indexes</a>
</div>
</div>
<div class="form-group text-fieldtype width-100">
Expand Down
2 changes: 1 addition & 1 deletion PowerTools/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ routes:
as: logs

/rebuild-search:
uses: rebuildSearchIndex
uses: rebuildSearchIndexes
as: powertools.rebuild-search

/clear-cache:
Expand Down

0 comments on commit b70576d

Please sign in to comment.