Drupal 6 provides a files table for managing files in your custom modules, but the correct usage isn't well/obviously documented. The following code works best in my experience:
$file = new stdClass();
$file->filename = file_munge_filename(trim(basename($_FILES['files']['name'][$source]), '.'), $extensions);
$file->filepath = $_FILES['files']['tmp_name'][$source];
$file->filemime = file_get_mimetype($file->filename);
$file->filesize = $_FILES['files']['size'][$source];
$file->uid = $user->uid;
$file->status = FILE_STATUS_TEMPORARY; //'FILE_STATUS_PERMANENT'
The Apache Solr Search module adds a lot of functionality to the base Drupal system. You can easily search by title, body, and CCK fields. One you'll often run into is many times the designer and/or client wants CCK field data in the search results. You can easily search, and filter by the CCK fields, but how do you get them back out of the Solr index to display? You could do something extremely inefficient like running node_load() for every returned node ID, but there are better answers.
There are two ways to rename the sorting methods available in the Drupal 6 Apache Solr module. First is the simpler method of changing the translation of the sort title as it is passed through t(). Second is changing the available sorts in the query object in a custom module. If you need to re-order, changing the query object is your only option. The default available sorts are listed in Solr_Base_Query.php:
/**
* Returns a default list of sorts.
*/
protected function default_sorts() {
// The array keys must always be real Solr index fields.
By default the Drupal ApacheSolr module does not display the total number of results for a given search. This is how to add it.
For my use it makes sense to add the result total to the Search form using hook_form_[form_id]_alter().
/**
* Implementation of hook_form_[form_id]_alter().
*/
function ms_solr_site_form_search_form_alter(&$form, &$form_state) {
if ($form['module']['#value'] == 'apachesolr_search') { //Will change all searches otherwise.
if (apachesolr_has_searched() && ($response = apachesolr_static_response_cache())) {
Pages
