You are here

function DrupalSolrMatchTestCase::_solr_index in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 6 tests/solr_index_and_search.test \DrupalSolrMatchTestCase::_solr_index()
1 call to DrupalSolrMatchTestCase::_solr_index()
DrupalSolrMatchTestCase::_setup in tests/solr_index_and_search.test
Set up a small index of items to test against.

File

tests/solr_index_and_search.test, line 55
Tests for the apachsolr module: index and search.

Class

DrupalSolrMatchTestCase
@file Tests for the apachsolr module: index and search.

Code

function _solr_index($documents) {
  $batch = 0;
  $batches = count($documents) / 20;
  while ($batch < $batches) {
    $batch++;
    $docs = array_splice($documents, 0, 20);
    try {
      $this->solr
        ->addDocuments($docs);
      $this->solr
        ->commit();
    } catch (Exception $e) {
      drupal_set_message($e
        ->getMessage());
    }
  }
}