Friday, December 23, 2011

How to rebuild index in CQ5 / WEM

Prerequisite: You have to stop your CQ instance (Except for AEM6 onward)

Also read

For CQ5.2X or CQ5.3 or upgraded CQ5.4 remove or rename following files or folder

1) /crx-quickstart/repository/version/copy/index*.tar
2) /crx-quickstart/repository/workspaces/crx.default/copy/index*.tar
3) /crx-quickstart/repository/workspaces/crx.default/index
4) /crx-quickstart/repository/repository/index

In some cases you can also recreate indexes by deleting or renaming following folders and files (Some of the files and folder has nothing to do with index, they are just removed for cleaning purpose

1) /crx-quickstart/repository/shared/journal
2) /crx-quickstart/repository/workspace/crx.default/index
3) /crx-quickstart/repository/workspace/crx.default/copy
4) /crx-quickstart/repository/workspace/version/copy/index*
5) /crx-quickstart/repository/index
6) /crx-quickstart/repository/shared/journal/control
7) /crx-quickstart/repository/shared/version/control
8) /crx-quickstart/repository/shared/workspace/crx.default/control
9) /crx-quickstart/logs

For CQ5.4 / CRX2.2 / CQ5.5 / CRX2.3 remove or rename following files and folders

1) /crx-quickstart/repository/workspaces/crx.default/index
2) /crx-quickstart/repository/workspaces/crx.default/index*.tar
3) /crx-quickstart/repository/version/index*.tar
4) /crx-quickstart/repository/tarJournal/index*.tar
5) /crx-quickstart/repository/repository/index

For AEM6 onward (If you are using oak MK), Rebuilding indexes can happen while system is running (Note that query would not run faster if you do reindex)

Please read and before doing re indexing.

I think best way to do reindexing in AEM6 is to use this tool

for doing full indexing of repo in AEM6 you can set reindex to true at oak:index node. More info is here

If you don't have access to install this tool then you can manually go to crxde repo and set reindex property to true for property you want to reindex (This is expensive operation, don't do it if you don't know what you are doing).

In some cases you need to stop your system remove/rename repository/index folder and then start instance again

Note: In some cases if your repository size is huge, It could take days to rebuild Lucene index. So Before you rebuild your index, make sure that you can afford that much of downtime.


  1. So many files name..
    As i am new in CQ5 world,I am not much able to uinderstand this indexing rebuilding purpose.Can you elaborate more plz.


  2. Its Really helpful and I am referring this for quick and fast info.
    Great Work.

  3. nice article dude..appreciating

  4. A colleague of mine referred me to this page. I had to build up the index again for the author-instance after my W7 system crashed while going to sleep mode. Thanks for help.

  5. The combined size of the /crx-quickstart/repository/shared/journal and /crx-quickstart/repository/repository/index is around 18GB.
    Do you have an approximate value for the time it will take for re-indexing?

    1. It might take between 2-4 hour to index that. It also depend upon memory assigned to JVM and machine config.

    2. What are the properties normally we configure under oak:index for the search indexing in AEM 6.0 ?

    3. property is called reindex for full content reindex

  6. how to verify if the re-index is complete ?

    1. Hello Max,

      For previous version of CQ you need to check log to see of re indexing is complete. Also CQ instance will not come up unless index creation is done.

      Foe AEM 6.1 system will not go down but you still have to check log to see if reindexing is done. Also in AEM 6.1 make sure that you read before reindexing.