VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/10.4-index-management-commands

⇱ Index Management Commands | MahoCommerce/maho | DeepWiki


Loading...
Last indexed: 15 May 2026 (ea8ab8)
Menu

Index Management Commands

Purpose and Scope

This document covers the CLI commands available for managing Maho's indexing system. These commands allow administrators to list, reindex, and monitor index processes from the command line. For information about the underlying indexing architecture and how indexers work internally, see Indexing System. For general CLI architecture, see CLI Architecture.

Overview

Maho provides several index management commands for operational control over the indexing system. These commands are registered in the main maho entry point maho53-56

CommandPurposeTypical Usage
index:listDisplay all configured indexes and their statusMonitoring and diagnostics
index:reindexReindex a single index by codeTargeted reindexing after data changes
index:reindex:allReindex all indexes sequentiallyFull system reindexing
index:reindex:productReindex product-related indexesProduct catalog updates

All index commands extend BaseMahoCommand lib/MahoCLI/Commands/BaseMahoCommand.php18-19 and initialize the Maho application in admin mode before execution via initMaho() lib/MahoCLI/Commands/BaseMahoCommand.php20-24

Sources: maho53-56 lib/MahoCLI/Commands/BaseMahoCommand.php18-24

Command Registration and Execution Flow

The index commands are registered in the Maho CLI entry point and interact with the Mage_Index module models.

CLI to Code Mapping

The following diagram bridges the natural language commands to the specific PHP classes and methods responsible for execution.

CLI to Code Entity Space


Sources: maho53-56 lib/MahoCLI/Commands/BaseMahoCommand.php18-24 lib/MahoCLI/Commands/IndexReindex.php48 lib/MahoCLI/Commands/IndexReindexAll.php38

index:list Command

Purpose

The index:list command displays all configured indexes with their current status, execution timestamps, and mode settings.

Implementation

The command retrieves the index process collection and outputs a formatted table with index metadata.

Execution Sequence


The debug() method on the process model returns an associative array containing the indexer code, status, timestamps, and execution mode lib/MahoCLI/Commands/IndexList.php36-39

Sources: lib/MahoCLI/Commands/IndexList.php29-44

index:reindex Command

Purpose

The index:reindex command reindexes a single index identified by its unique code (e.g., catalog_product_price).

Arguments

ArgumentTypeRequiredDescription
index_codestringYesThe code of the index to process

Execution Logic

  1. Initialization: Calls initMaho() to set up the admin environment lib/MahoCLI/Commands/IndexReindex.php37
  2. Lookup: Finds the process model associated with the code via Mage::getModel('index/indexer')->getProcessByCode($indexCode) lib/MahoCLI/Commands/IndexReindex.php40
  3. Execution: Measures duration and calls $index->reindexEverything() lib/MahoCLI/Commands/IndexReindex.php46-50

Sources: lib/MahoCLI/Commands/IndexReindex.php29-53

index:reindex:all Command

Purpose

The index:reindex:all command reindexes every configured index sequentially.

Implementation Detail

The command iterates through the Mage_Index_Model_Resource_Process_Collection. For each process, it executes reindexEverything() and reports the individual duration lib/MahoCLI/Commands/IndexReindexAll.php32-41 Finally, it outputs the total duration for all indexing tasks lib/MahoCLI/Commands/IndexReindexAll.php43-45

Sources: lib/MahoCLI/Commands/IndexReindexAll.php28-48

Common Usage Patterns

Monitoring Status


Rebuilding Search Index

If search results are inconsistent, rebuild the fulltext index:


Full Maintenance

Typically performed during deployment or after large data imports:


Sources: lib/MahoCLI/Commands/IndexList.php24 lib/MahoCLI/Commands/IndexReindex.php24 lib/MahoCLI/Commands/IndexReindexAll.php23