Skip to content

Instantly share code, notes, and snippets.

@dergachev
Last active December 20, 2015 11:49
Show Gist options
  • Save dergachev/6126195 to your computer and use it in GitHub Desktop.
Save dergachev/6126195 to your computer and use it in GitHub Desktop.
Testing indexing of apachesolr.module
##
## Solr index testing tricks
##
## Tested with apachesolr-6.x-2.x (more recent versions might have different drush syntax
# to delete an index outside of drupal, after `drush solr-index` ran
rm -Rf /opt/solr/solr-home/data
service tomcat6 restart
# undo drush solr-reindex
drush sqlq "UPDATE apachesolr_search_node SET changed = 0 WHERE status=1;"
# mark the latest 100 published nodes for re-indexing
drush sqlq 'UPDATE apachesolr_search_node SET changed = UNIX_TIMESTAMP(NOW()) WHERE status = 1 ORDER BY nid DESC LIMIT 100;'
# index ~200 nodes
drush -d php-eval 'apachesolr_search_cron();'
# commit to ensure the new docs appear in queries right away
curl 'http://localhost:8080/solr/update?commit=true\&waitFlush=true\&waitSearcher=true'
# most results seem to contain health
drush solr-search health
# batch index everything
drush solr-index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment