Index: contrib/exhibit_apachesolr/exhibit_apachesolr.info =================================================================== RCS file: contrib/exhibit_apachesolr/exhibit_apachesolr.info diff -N contrib/exhibit_apachesolr/exhibit_apachesolr.info --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ contrib/exhibit_apachesolr/exhibit_apachesolr.info 8 Nov 2008 16:18:41 -0000 @@ -0,0 +1,8 @@ +; $Id$ +name = Exhibit ApacheSolr +description = Provides Exhibit JSON data feeds of Drupal ApacheSolr Search results +package = SIMILE +dependencies[] = exhibit +dependencies[] = apachesolr +core = 6.x +php = 5.2 Index: contrib/exhibit_apachesolr/exhibit_apachesolr.module =================================================================== RCS file: contrib/exhibit_apachesolr/exhibit_apachesolr.module diff -N contrib/exhibit_apachesolr/exhibit_apachesolr.module --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ contrib/exhibit_apachesolr/exhibit_apachesolr.module 8 Nov 2008 16:18:41 -0000 @@ -0,0 +1,20 @@ + array( + 'page callback' => 'exhibit_apachesolr_get_search', + 'page arguments' => array(3), + 'type' => MENU_CALLBACK, + 'access arguments' => array('access exhibits'), + 'file' => 'exhibit_apachesolr.pages.inc', + ), + ); +} Index: contrib/exhibit_apachesolr/exhibit_apachesolr.pages.inc =================================================================== RCS file: contrib/exhibit_apachesolr/exhibit_apachesolr.pages.inc diff -N contrib/exhibit_apachesolr/exhibit_apachesolr.pages.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ contrib/exhibit_apachesolr/exhibit_apachesolr.pages.inc 8 Nov 2008 16:18:41 -0000 @@ -0,0 +1,34 @@ + array('label' => t('Result'), 'pluralLabel' => t('Results'))); + $fields = array( + 'score' => array('valueType' => 'number'), + 'author' => array('valueType' => 'item'), + 'created' => array('valueType' => 'date'), + 'type' => array('valueType' => 'item'), + 'url' => array('valueType' => 'url'), + ); + $results = apachesolr_search_search('search', $keys); + foreach ($results as $result) { + $items[] = exhibit_compact_item(array( + 'type' => 'search', + 'id' => $result['link'], + 'label' => $result['title'], + 'author' => $result['user'], + 'created' => gmstrftime(EXHIBIT_DATE_FORMAT, $result['date']), + 'score' => $result['score'], + 'snippet' => $result['snippet'], + 'type' => $result['type'], + 'url' => $result['link'], + )); + } + + $filename = drupal_get_path('module', 'exhibit') .'/exhibit.pages.inc'; + require_once $filename; + exhibit_output('application/json', drupal_to_js(exhibit_json($items, $types, $fields))); +}