Commit 48f90927d2d195b0a539a197993a2716c09bba32

Authored by Sergio Oliveira
2 parents 9372e139 e71cd2dd

Merge branch 'update_puppet' of github.com:colab-community/colab into update_puppet

Showing 1 changed file with 30 additions and 0 deletions   Show diff stats
fabfile.py
... ... @@ -283,5 +283,35 @@ def solr(port=8983):
283 283 """Start Solr"""
284 284 with cd('~/solr-4.6.1/colab'), settings(user='colab'):
285 285 run('java -jar start.jar -Djetty.port={}'.format(port))
  286 +
  287 +
  288 +@task
  289 +def rebuild_index(age=None, batch=None):
  290 + """Rebuild the solr index"""
  291 + age_arg = ''
  292 + if age:
  293 + age_arg = '--age={}'.format(age)
  294 +
  295 + batch_arg = ''
  296 + if batch:
  297 + batch_arg = '--batch-size={}'.format(batch)
  298 +
  299 + manage('rebuild_index {} {}'.format(age_arg, batch_arg))
  300 +
  301 +
  302 +@task
  303 +def update_index():
  304 + """Update solr index"""
  305 + manage('update_index')
  306 +
  307 +
  308 +@task
  309 +def build_schema():
  310 + """Build solr schema"""
  311 + solr_schema_file = '~/solr-4.6.1/colab/solr/collection1/conf/schema.xml'
  312 + manage('build_solr_schema -f {}'.format(solr_schema_file))
  313 + run(r'sed -i "s/<fields>/<fields>\n<field name=\"_version_\" type=\"long\" indexed=\"true\" stored =\"true\"\/>/" {}'.format(solr_schema_file))
  314 +
  315 +
286 316 # Main
287 317 environment()
... ...