? .svn ? SolrPhpClient ? contrib/.svn ? contrib/apachesolr_image/.svn ? contrib/apachesolr_lang/.svn ? contrib/apachesolr_mlt/.svn ? contrib/apachesolr_multisitesearch/.svn ? contrib/apachesolr_nodeaccess/.svn ? contrib/apachesolr_og/.svn ? tests/.svn Index: Solr_Base_Query.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/Solr_Base_Query.php,v retrieving revision 1.1.4.40.4.3 diff -u -p -r1.1.4.40.4.3 Solr_Base_Query.php --- Solr_Base_Query.php 13 Oct 2009 06:49:33 -0000 1.1.4.40.4.3 +++ Solr_Base_Query.php 10 Nov 2009 11:32:07 -0000 @@ -20,7 +20,7 @@ class Solr_Base_Query implements Drupal_ $filter = array(); $filter['#query'] = $match[0]; $filter['#exclude'] = ($match[1] == '-'); - $filter['#value'] = trim($match[2]); + $filter['#value'] = trim(urldecode($match[2])); if (isset($match[3])) { // Extra data for range queries $filter['#start'] = $match[3]; Index: apachesolr.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.admin.inc,v retrieving revision 1.1.2.32.2.8 diff -u -p -r1.1.2.32.2.8 apachesolr.admin.inc --- apachesolr.admin.inc 6 Nov 2009 09:39:34 -0000 1.1.2.32.2.8 +++ apachesolr.admin.inc 10 Nov 2009 11:32:07 -0000 @@ -82,6 +82,12 @@ function apachesolr_settings() { '#default_value' => variable_get('apachesolr_set_nodeapi_messages', 1), '#options' => array(0 => t('Disabled'), 1 => t('Enabled')), ); + $form['advanced']['apachesolr_multisite_names'] = array( + '#type' => 'textarea', + '#title' => t('Multisite Names'), + '#description' => t('Enter sites and names separated by a pipe, for example: http://www.example.com/|Example'), + '#default_value' => variable_get('apachesolr_multisite_names', ''), + ); return system_settings_form($form); } Index: apachesolr_search.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v retrieving revision 1.1.2.6.2.111.4.7 diff -u -p -r1.1.2.6.2.111.4.7 apachesolr_search.module --- apachesolr_search.module 23 Oct 2009 11:47:03 -0000 1.1.2.6.2.111.4.7 +++ apachesolr_search.module 10 Nov 2009 11:32:07 -0000 @@ -195,7 +195,6 @@ function apachesolr_search_view($type = * @throws Exception */ function apachesolr_search_execute($keys, $filters, $solrsort, $base_path = '', $page = 0, $caller = 'apachesolr_search') { - $params = array(); // This is the object that knows about the query coming from the user. $query = apachesolr_drupal_query($keys, $filters, $solrsort, $base_path); @@ -428,8 +427,9 @@ function apachesolr_process_response($re drupal_alter('apachesolr_search_result', $doc); // Copy code from comment_nodeapi(). $extra[] = format_plural($doc->comment_count, '1 comment', '@count comments'); + $site = parse_url($doc->url); $results[] = array( - 'link' => url($doc->path), + 'link' => url($doc->url), 'type' => apachesolr_search_get_type($doc->type), 'title' => $doc->title, 'user' => theme('username', $doc), @@ -503,11 +503,17 @@ function apachesolr_search_apachesolr_fa 'info' => t('Apache Solr Search: Filter by updated date'), 'facet_field' => 'changed', ); + $facets['created'] = array( 'info' => t('Apache Solr Search: Filter by post date'), 'facet_field' => 'created', ); + $facets['site'] = array( + 'info' => t('Apache Solr Search: Filter by site'), + 'facet_field' => 'site', + ); + // A book module facet. if (module_exists('book')) { $facets['is_book_bid'] = array( @@ -620,7 +626,7 @@ function apachesolr_search_block($op = ' } } $vid = substr($delta, 7); - $vocab = taxonomy_vocabulary_load($vid); + $vocab = taxonomy_get_vocabulary($vid); if (is_numeric($vid) && is_array($terms) && isset($terms[$vid]) && is_array($terms[$vid])) { ksort($terms[$vid]); $limit = isset($initial_limits['apachesolr_search'][$delta]) ? $initial_limits['apachesolr_search'][$delta] : $limit_default; @@ -665,6 +671,8 @@ function apachesolr_search_block($op = ' return apachesolr_facet_block($response, $query, 'apachesolr_search', $delta, $delta, t('Filter by author'), 'apachesolr_search_get_username'); case 'type': return apachesolr_facet_block($response, $query, 'apachesolr_search', $delta, $delta, t('Filter by type'), 'apachesolr_search_get_type'); + case 'site': + return apachesolr_facet_block($response, $query, 'apachesolr_search', $delta, $delta, t('Filter by site'), 'apachesolr_search_get_site'); case 'changed': return apachesolr_date_facet_block($response, $query, 'apachesolr_search', $delta, $delta, t('Filter by modification date')); case 'created': @@ -722,6 +730,32 @@ function apachesolr_search_get_username( } /** + * Callback function for the 'Filter by site' facet block. + */ +function apachesolr_search_get_site($facet) { + // Get the configures site names (newline separates rows. Each row is site|name pair) + $names = variable_get('apachesolr_multisite_names', ''); + + // If there are some names... + if (!empty($names)) { + // ... explode on newline + $names = explode("\n", $names); + + // Foreach name row... + foreach ($names as $row) { + // ... explode on pipe and separate into site and name variables. + list($site, $name) = explode('|', trim($row)); + + // If the sites match, return the name, otherwise continue to the next row + if ($site == $facet) return $name; + } + } + + // If no matches, return the facet value. + return $facet; +} + +/** * Callback function for the 'Filter by type' facet block. */ function apachesolr_search_get_type($facet) { @@ -1001,6 +1035,13 @@ function theme_apachesolr_breadcrumb_typ } /** + * Return the human readable text for a multisite site. + */ +function theme_apachesolr_breadcrumb_site($field) { + return apachesolr_search_get_site($field['#value']); +} + +/** * Return the title of a book. */ function theme_apachesolr_breadcrumb_is_book_bid($bid) {