Skip to content

Commit

Permalink
Updates index command
Browse files Browse the repository at this point in the history
  • Loading branch information
austintoddj committed Jul 21, 2016
1 parent 6c49f84 commit 02dcf4f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/Console/Commands/IndexPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ class IndexPosts extends Command
*
* @var string
*/
protected $signature = 'canvas:indexer';
protected $signature = 'canvas:index';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Index the posts and tags table';
protected $description = 'Build the site index for searching';

/**
* Execute the console command.
Expand All @@ -33,20 +33,23 @@ public function handle()
$this->tnt->loadConfig(config('services.tntsearch'));

$this->createPostsIndex();
$this->info('Success! The posts index has been completed.');

$this->createTagsIndex();
$this->info('Success! The tags index has been completed.');
}

public function createPostsIndex()
{
$this->info("Indexing posts table and saving it to posts.index");
{
$this->comment(PHP_EOL . 'Indexing posts table and saving it to /storage/posts.index...');
$indexer = $this->tnt->createIndex('posts.index');
$indexer->query('SELECT id, title, subtitle, content_raw, meta_description FROM posts;');
$indexer->run();
}

public function createTagsIndex()
{
$this->info("Indexing tags table and saving it to tags.index");
$this->comment(PHP_EOL . 'Indexing tags table and saving it to /storage/tags.index...');
$indexer = $this->tnt->createIndex('tags.index');
$indexer->query('SELECT id, tag, title, subtitle, meta_description FROM tags;');
$indexer->run();
Expand Down

0 comments on commit 02dcf4f

Please sign in to comment.