For Alfresco 4.x and Solr 1.4:
#! /bin/bash export ALF_HOME=/opt/alfresco4 export SOLR_HOME=/opt/alfresco4/alf_data/solr $ALF_HOME/alfresco.sh stop sleep 10 rm -rf $SOLR_HOME/workspace/SpacesStore/* rm -rf $SOLR_HOME/archive/SpacesStore/* rm -f $SOLR_HOME/workspace-SpacesStore/alfrescoModels/* rm -f $SOLR_HOME/archive-SpacesStore/alfrescoModels/* $ALF_HOME/alfresco.sh start
https://docs.alfresco.com/4.1/tasks/solr-reindex.html
For Alfresco 5.x and Solr 4:
#! /bin/bash export ALF_HOME=/opt/alfresco50c export SOLR_HOME=/opt/alfresco50c/alf_data/solr4 $ALF_HOME/alfresco.sh stop sleep 10 rm -rf $SOLR_HOME/index/workspace/SpacesStore/* rm -rf $SOLR_HOME/index/archive/SpacesStore/* rm -rf $SOLR_HOME/content/* rm -f $SOLR_HOME/model/* $ALF_HOME/alfresco.sh start
For Alfresco 5.2 and SOLR 6 (Alfresco Search Services)
#! /bin/bash export SOLR_BASE=/opt/solr6/ass110 export SOLR_HOME=$SOLR_BASE/solrhome export SOLR_BIN=$SOLR_BASE/solr/bin #$SOLR_BIN/solr stop rm -f $SOLR_HOME/archive/index/* rm -f $SOLR_HOME/alfresco/index/* rm -f $SOLR_HOME/alfrescoModels/* rm -rf $SOLR_BASE/contentstore/_DEFAULT_/db/* #$SOLR_BIN/solr start