Phosphorum\Search\Indexer::indexAll PHP Method

indexAll() public method

Indexes all posts in the forum in ES
public indexAll ( )
    public function indexAll()
    {
        $deleteParams = ['index' => $this->config->get('index', 'phosphorum')];
        try {
            $this->client->indices()->delete($deleteParams);
        } catch (Missing404Exception $e) {
            $this->logger->info('The index does not exist yet. Skip deleting...');
        } catch (\Exception $e) {
            $this->logger->error("Indexer: {$e->getMessage()}. {$e->getFile()}:{$e->getLine()}");
        }
        foreach (Posts::find('deleted != ' . Posts::IS_DELETED) as $post) {
            $this->doIndex($post);
        }
    }

Usage Example

Beispiel #1
0
 public function run()
 {
     $search = new Indexer();
     $search->indexAll();
     //print_r($search->searchCommon(array('title' => 'ubuntu', 'category' => 6)));
 }
All Usage Examples Of Phosphorum\Search\Indexer::indexAll