How To Use Indexing in Magento Community Edition (CE) 1.8

Indexing is the process Magento uses to speed up access to items in your web store. By periodically reindexing content, you make your web store load faster with the correct data.

Table of Contents

Note: The information in this article applies to Magento Community Edition 1.8 and later only.

Why Does Magento Reindex?

Indexing is how Magento transforms data such as products, categories, and so on, to improve the performance of your web store. As data changes, the transformed data must be updated—or reindexed. Magento has a sophisticated architecture that stores lots of merchant data (including catalog data, prices, users, stores, and so on) in many database tables. To optimize web store performance, Magento accumulates data into special tables using indexers.

For example, suppose you change the price of an item from $4.99 to $3.99. Magento must reindex the price change to display it on your web store.

Without indexing, Magento would have to calculate the price of every product on the fly—taking into account shopping cart price rules, bundle pricing, discounts, tier pricing, and so on. Loading the price for a product would take a long time, possibly resulting in cart abandonment.

Using the Index Management Page

To understand how indexing works and to reindex when necessary, you must log in to the Admin Panel as an administrator and click System > Index Management. The following page displays:

The page displays differently if you enabled the flat catalog options. (In the Admin Panel, click System > Configuration > CATALOG > Catalog. In the right pane, expand Frontend and, from the Use Flat Catalog Category and Use Flat Catalog Category lists, click Yes.)

The following figure shows an example of how the System Management page displays when the flat catalog options are enabled.

Using the Columns on the Index Management Page

The following table discusses the meaning of the columns on this page.

Column name Description
Index Name of the indexer.
Description Description of the indexer.
Mode In the preceding figures, most of the indicated indexers are set to Update on Save, which means a reindex is required when a change is saved in the Admin Panel. To change this option, see How to Manually Reindex.
Status

Displays one of the following:

  • Reindex Required if a change has been made that requires reindexing. If a check box and Reindex Required link displays in that row, you can manually reindex as discussed in How to Manually Reindex.
  • Ready if the index is up-to-date.
Update Required Indicates whether or not you must manually reindex. (The value in the Mode column indicates whether the index must be manually updated.)
Updated At Displays the date and time an index was last manually updated, or Never if the index has never been updated.
Action Click the Reindex Data link to reindex that indexer only.

How to Manually Reindex

To inform you that one or more indexers must be rebuilt, a message banner similar to the following displays in the Admin Panel.

When you're notified that indexes must be rebuilt, use the instructions in the following table.

Task Steps to perform task
Manually reindex

To rebuild one or more indexers:

  • To update more than one indexer at a time, select the check box next to its name. From the Action list, click Reindex Data and click Submit.
  • To update one index only, click the Reindex Data link in the Action column on the right.
Change the indexing mode

By default, all indexers are set to Update on Save which means reindexing occurs after a change is made in the Admin Panel.

The other option is to manually reindex every time a change is made. (For example, if you change product attributes in the Admin Panel, you must manually update the Product Attributes index.)

To change the indexing mode:

  1. Select the check box next to one or more indexers to change.
  2. From the Actions list, click Change Index Mode.
    This causes the Index Mode list to display.
  3. From the Index Mode list, click the desired option.
  4. Click Submit. The value in the Mode column updates to indicate your choice.

Enabling Frontend Options for Flat Catalog Indexing

Magento uses the Entity-Attribute-Value (EAV) model for storing customer, product, and category data in its database. Although the EAV model enables you to have a completely extensible attributes for those objects, object attributes are stored in multiple tables rather than one very large table.

Because attributes are stored in many tables—and that includes copies of some of the same attributes—SQL queries are long and complex. The flat catalog feature creates new tables on the fly, where each row contains all necessary data about a product or category.

To use flat catalog indexing, you must enable flat products and categories for your web store as follows:

  1. Log in to the Admin Panel as an administrator.
  2. Click System > Configuration.
  3. In the CATALOG group, click Catalog.
  4. In the right pane, click Frontend.
  5. From the Use Flat Catalog Category list, click Yes.
  6. From the Use Flat Catalog Product list, click Yes.
    The following figure shows an example.
  7. In the upper right corner, click Save Config.

Using URL Rewrites

URL rewriting (sometimes referred to as request rewriting) enables you to access resources such as product pages, categories, and so on, by additional uniform resource identifiers (URIs).

For example, suppose your web store has a product named Microsoft Natural Ergonomic Keyboard 4000 assigned to the Computer Peripherals category. By default, the product can be accessed using a URL like http://www.example.com/peripherals/microsoft-natural-ergonomic-keyboard-4000.html. URL rewrite enables you to create an additional URL like http://www.example.com/great-keyboard.html.

Using URL rewriting, you can choose a combination of:

  • Custom, category, or product URL rewrite type

    Note: To redirect from one or more old URLs to a single new URL, use custom URL rewrites. You can do this, for example, if you're transitioning to Magento from another system.

  • Request path which can be any valid URI (for example, for a seasonal promotion, you might want a product URL to end with best-valenties-gift.html)

    Note: Every request path must be globally unique among all products and categories in a particular store. In other words, in a store, no two products can have the same request path, and no two categories can have the same request path.

  • Target path which specifies the actual path to the product or category (for example, for a promotion, you might want a category named spring-sale)

    Note: The custom and target path options enable you to redirect to a custom path, such as a Content Management System (CMS) path. The target path must be valid; otherwise, the redirect results in a 404 (Not Found) error on your web store.

  • Redirect type (determines how search engines rank the redirect)
    • None (useful if you don't want the customer to have to wait the additional time required to redirect)
    • Temporary (HTTP 302 (Found))
    • Permanent (HTTP 301 (Moved Permanently))

      Note: Magento recommends choosing a permanent redirect because search engines generally preserve the page's ranking. A 302 (Temporary) redirect does not preserve a page's ranking. For more information, consult a resource such as seomoz.org or google.com.

For more information, see one of the following sections:

Sample URL Rewrites

Magento enables you to create rewrites to add additional URLs for items. You can do this, for example, to make items more attractive to buyers. You can create a redirect to any valid path, including paths you create in your CMS.

For example, you can change the following product URL:

http://www.example.com/peripherals/microsoft-natural-ergonomic-keyboard-4000.html

and add another one such as:

http://www.example.com/best-keyboard.html

or you can create another URL for a category like:

http://www.example.com/all-on-sale.html

To create a category path like the following for a promotion, you must first create a path using the CMS or by other means.

http://www.example.com/save-now/spring-sale

URL Rewrite Option: Setting Category and Product URL Suffixes

By default, Magento enables web store customers to access products and categories with a URL that ends with .html. You can optionally change both the product and category URL suffix to any alphanumeric string.

The examples throughout this section use the default suffix, .html.

To optionally change the product and category URLs:

  1. Log in to the Admin Panel as an administrator.
  2. Click System > Configuration.
  3. In the CATALOG group, click Catalog.
  4. In the right pane, expand Search Engine Optimizations.
  5. Enter valid values in the Product URL Suffix and Category URL Suffix fields.
  6. Click Save Config at the top of the page.

Getting Started with URL Rewrites

To get started:

  1. Log in to the Admin Panel as an administrator.
  2. Click Catalog > URL Rewrite Management.
    The following figure shows a sample URL Rewrite Management page.
  3. The preceding figure shows some default URL rewrites that are created for the Magento sample data.

    The following table discusses the meanings of the columns on this page.

    Column Description
    ID A unique identifier Magento assigns to the URL rewrite.
    Store View Name of the store with which the URL rewrite is associated.
    Type Typically displays either System (system, or Magento default, URL rewrites) or Custom) URL rewrites you configure.
    ID Path The system, or actual, URI of the product or category, to redirect from.
    Request Path

    The unique part of the URI to redirect from. The request path can be any URL-encoded string. For example, great-valentines-gift.html.

    Note: Every request path must be globally unique among all products and categories. In other words, no two products can have the same request path, and no two categories can have the same request path.

    Target Path The URI that identifies the category, CMS page, and so on, to redirect to. The target path you enter must be valid; otherwise, the redirect fails with a 404 (Not Found).
    Options Displays one of the following:
    • R if you chose a temporary (HTTP 302) redirect.
    • RP if you chose a permanent (HTTP 301) redirect.
    • Nothing if you chose to not redirect.
    Action Click Edit in this column to edit or delete the redirect. (You can also click the row itself.)

Continue with one of the following sections:

Creating New URL Rewrites

This section discusses how to create new custom, product, or category URL rewrites.

  1. Complete the tasks discussed in:
  2. Click Add URL Rewrite.
  3. From the Create URL Rewrite list, click one of the following:
    Option Description
    For category Redirect to a category page. Magento system category paths use the format catalog/category/view/id/category-string
    You can optionally redirect to a custom CMS path if you have already set one up.
    For product Redirect to a product page. Magento system product paths use the format catalog/product/view/id/string or catalog/product/view/id/product-string/category/category-string
    You can optionally redirect to a custom CMS path if you have already set one up.
    Custom Redirect to any valid path. To use this option, you must know the exact ID path, request path, and target path.

    The bottom section of the page refreshes to reflect the choices available for the type of URL rewrite you selected.
  4. Do any of the following:
    • Product redirect: Click the name of the product.
    • Category redirect: Click the name of the category.
    • Custom redirect: Enter the required information. For more information, see step 6.
  5. Product redirect only. Optionally click the name of a category, or click Skip choosing category to let the product remain associated with its original category.
    You need to click a category name only if you want the URL rewrite to go to a different category.
  6. Enter the following information:
    Option Description
    Type Usually displays Custom.
    Store From the list, click the name of the store to which the URL rewrite applies.
    ID path Displays the default (that is, actual) path to the product or category to redirect from.
    Request Path

    Enter a unique path to identify the product or category to redirect from. The path can be in any format that uses URL percent encoding. Examples:

    best-valentines-gift.html

    greatest-keyboard.html

    products-on-sale.html

    best/products/on/sale/now.html

    Note: For every store, every request path must be globally unique among all products and categories. In other words, on any store, no two products can have the same request path. and no two categories can have the same request path.

    Target Path Enter a path to redirect to in one of the following formats:
    • Custom redirect: Any valid path.
    • Category redirect:
      • System path: Unless you set up a custom path using the CMS, you should leave this field unchanged. By default, system category paths have a format like: catalog/category/view/id/category-string
      • Custom path: Any valid path
    • Product redirect:
      • System path: Unless you set up a custom path using the CMS, you should leave this field unchanged. By default, system product paths have a format like:catalog/product/view/id/product-string or catalog/product/view/id/product-string/category/category-string
      • Custom path: Any valid path
    Redirect From the list, click:
    • No
    • Temporary (302)
    • Permanent (301). Magento recommends choosing this option because search engines retain the page ranking.
    Description Enter an optional description.

    Note: To create custom product redirects from a set of old product URLs to a single new URL, enter the relative path to the old URL in the ID Path and Request Path fields, and enter the relative or absolute path to the new URL in the Target Path field.

  7. At the top right corner of the page, click Save.
    The following figure shows a sample product permanent redirect that adds the URL http://www.example.com/greatest-keyboard.html to the English web site for a product whose ID is 159.

For examples of how to verify URL rewrites, see the next section.

Verifying URL Rewrites

This section discusses how to verify that a sample product URL rewrite displays correctly on your Magento web store.

  1. In the Admin Panel, click System > Index Management.
  2. Click Select All at the top of the left column.
  3. From the Actions list, click Reindex Data.
  4. Click Submit.
    The following figure shows an example.
  5. Click Catalog > URL Rewrite Management.
    The URL Rewrite Management page displays.
  6. Click a row corresponding to a product redirect.
    The following figure shows the example used in this section.
  7. Open a new browser window or tab page.
  8. In the browser's location or address field, construct the URL to the product as follows:
    • Start with the scheme (http:// or https://, then your web store's domain name, followed by /.
    • Append to it the value of the Target Path field from the Admin Panel, followed by /.
    • Append to it the value of the Request Path field.
    For a Magento web store whose domain is http://www.example.com, the URL should look like the following:
    http://www.example.com/greatest-keyboard.html
  9. Press Enter.
    The following figure shows an example of a successful redirect.

    Note: If a 404 (Not Found) displays, verify the target path precedes the request path and that each path is separated by one / character.

  10. Optionally verify category and custom redirects the same way.

Editing or Deleting URL Rewrites

To edit or delete a URL rewrite:

  1. Log in to the Admin Panel as an administrator.
  2. Click Catalog > URL Rewrites.
    The URL Rewrite Management page displays.
  3. Click the row of the URL rewrite to edit or delete.
    To edit a URL rewrite, you can also click Edit in the Action column.
  4. To delete the URL rewrite, click Delete. You are required to confirm the action.
    To edit a redirect, edit or change the information displayed on your screen. For additional help, see Creating New URL Rewrites.

Troubleshooting

This section discusses how to resolve the following error trying to save a URL rewrite:

ID Path for Specified Store already exists.

In any particular store, all request paths must be unique. Make sure the path is unique and try again.

If you're trying to create a single redirect from multiple old URLs, set up your URL rewrites similar to the following.

In particular, use the same relative URL for both ID Path and Request Path. These represent the URL to redirect from. The Target Path field specifies the URL to redirect to. You can enter either a relative or absolute URL.

Indexing is the process Magento uses to speed up access to items in your web store. By periodically reindexing content, you make your web store load faster with the correct data.

RSS: This Entry| All Blog Posts (RSS)