%d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))', $change, $last, $change, $change, $change)); return array('remaining' => $remaining, 'total' => $total); case 'search': global $pager_total; // This is the object that does the communication with the solr server. $solr =& apachesolr_get_solr(variable_get('apachesolr_host', 'localhost'), variable_get('apachesolr_port', 8983), variable_get('apachesolr_path', '/solr')); // This is the object that knows about the query coming from the user. $query =& apachesolr_drupal_query($keys); $results = array(); try { $facet_limits = variable_get('apachesolr_facet_limits', array()); $facet_limit = (count($facet_limits) > 0) ? max($facet_limits) : 10; $params = array( //'qt' => 'standard', 'fl' => '*,score', 'rows' => variable_get('apachesolr_rows', 10), 'facet' => 'true', 'facet.limit' => $facet_limit, 'facet.field' => array('tid', 'type', 'uid', 'language'), 'facet.mincount' => 1, 'facet.sort' => 'true' ); if (isset($_GET['solrsort'])) { $sort = check_plain($_GET['solrsort']); $params['sort'] = $sort; } if ($fields = apachesolr_cck_fields()) { foreach ($fields as $name => $field) { $index_key = apachesolr_index_key($field); $params['facet.field'][] = $index_key; } } $page = isset($_GET['page']) ? $_GET['page'] : 0; $params['start'] = $page * $params['rows']; $response = $solr->search($query->get_query(), $params['start'], $params['rows'], $params); apachesolr_has_searched(TRUE); $total = $response->numFound; // The response is cached so that it is accessible to the blocks and anything // else that needs it beyond the initial search. apachesolr_static_response_cache($response); pager_query("SELECT %d", $params['rows'], 0, NULL, $total); if ($total > 0) { foreach ($response->documents as $doc) { $extra = node_invoke_nodeapi(&$doc, 'search result'); $extra['score'] = $doc->score; $snippet = search_excerpt($keys, $doc->body); if (trim($snippet) == '...') { $snippet = ''; } $results[] = array('link' => url('node/'. $doc->nid, array('absolute' => TRUE)), 'type' => node_get_types('name', $doc), 'title' => $doc->title, 'user' => theme('username', $doc), 'date' => $doc->changed, 'node' => $doc, 'extra' => $extra, 'score' => $doc->score, 'snippet' => $snippet); } } // Set breadcrumb drupal_set_breadcrumb($query->get_breadcrumb()); return $results; } // try catch (Exception $e) { watchdog('Apache Solr', $e->getMessage(), WATCHDOG_ERROR); } } // switch }