Performing a full Solr reindex in Alfresco

Suddenly one day I logged in to my Alfresco Share server and browsing my favourite site’s repository realised that clicking on a document tag didn’t work, i.e., didn’t show me all the tagged nodes in the site. The Solr index where that information is stored was somehow corrupted.

Performing a full Solr reindex did the trick for me and here are the steps I followed:

1. Confirm the location of the Solr core directories for archive-SpacesStore and workspace-SpacesStore cores. This can be determined from the solrcore.properties file for both the cores.

By default, the solrcore.properties file can be found at $ALFRESCO_HOME/alf_data/solr/workspace-SpacesStore/conf and $ALFRESCO_HOME/alf_data\solr\archive-SpacesStore\conf.

The Solr core location is defined in the solrcore.properties file as:

# data is in ${data.dir.root}/${data.dir.store} 

data.dir.root=/path/to/your/alfresco/home/alf_data/solr
data.dir.store=workspace/SpacesStore

2. Shut down Alfresco:

# $ALFRESCO_HOME/alfresco.sh stop

3. Delete the contents of the index data directories for each Solr core at ${data.dir.root}.

# rm -f $ALFRESCO_HOME/alf_data/solr/workspace/SpacesStore/*
# rm -f $ALFRESCO_HOME/alf_data/solr/archive/SpacesStore/*

4. Delete all the Alfresco models for each Solr core at ${data.dir.root}.

# rm -f $ALFRESCO_HOME/alf_data/solr/workspace-SpacesStore/alfrescoModels/*
# rm -f $ALFRESCO_HOME/alf_data/solr/workspace-SpacesStore/alfrescoModels/*

5. Start Alfresco server up:

# $ALFRESCO_HOME/startup.sh start

6. Monitor the application server logs for Solr. You will get the following warning messages on bootstrap:

WARNING: [alfresco] Solr index directory '/path/to/alfresco/home/solr/workspace/SpacesStore/index' doesn't exist. Creating new index...
06-Nov-2013 11:21:11 org.apache.solr.handler.component.SpellCheckComponent inform
WARNING: No queryConverter defined, using default converter
06-Nov-2013 11:21:11 org.apache.solr.core.SolrCore initIndex
WARNING: [archive] Solr index directory '/path/to/alfresco/home/alf_data/solr/archive/SpacesStore/index' doesn't exist. Creating new index... 

The reindex process requires a lot of system memory to complete so you can see a lot of Our of Memory errors on the bootstrap logs. If this is the case you just need to tweak the JAVA_OPTS variable. Do that by editing the $ALFRESCO_SERVER/tomcat/scripts/ctl.sh script and adding the following line:

export JAVA_OPTS="-XX:MaxPermSize=1024m -Xms128m -Xmx1024m

before the line with:

$TOMCAT_BINDIR/startup.sh
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s