You are here

function apachesolr_drush_solr_search in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 8 drush/apachesolr.drush.inc \apachesolr_drush_solr_search()
  2. 5.2 apachesolr.drush.inc \apachesolr_drush_solr_search()
  3. 6.3 drush/apachesolr.drush.inc \apachesolr_drush_solr_search()
  4. 6 drush/apachesolr.drush.inc \apachesolr_drush_solr_search()
  5. 7 drush/apachesolr.drush.inc \apachesolr_drush_solr_search()
1 string reference to 'apachesolr_drush_solr_search'
apachesolr_drush_command in drush/apachesolr.drush.inc
Implementation of hook_drush_command().

File

drush/apachesolr.drush.inc, line 154
drush integration for apachesolr.

Code

function apachesolr_drush_solr_search() {
  $args = func_get_args();
  $keys = implode(' ', $args);
  foreach (apachesolr_search_execute($keys, '', '') as $result) {
    $output = 'node/' . $result['node']->nid . ' ' . dt('by @name (user/@uid)', array(
      '@name' => strip_tags($result['user']),
      '@uid' => $result['node']->uid,
    )) . "\n";
    $output .= dt('title: ') . $result['title'] . "\n";
    $output .= preg_replace('/[\\s]+/', ' ', strip_tags($result['snippet'])) . "\n\n";
    drush_print($output);
  }
}