Software engineer, data guy, Open Source enthusiast, New Hampshire resident, husband, father. Fan of guitars, hiking, photography, homebrewing, sarcasm.
Drupal 6: Implementing visual search results with search lucene and lightbox2
I created a Drupal site to host my photography in CCK Imagefield nodes and used Lucene to enhance my search functionality. By default Drupal’s search results are text-based so I decided to add some code to show image thumbnails in my search results. I checked out Drupal Lucene’s hooks and decided to implement a hook_luceneapi_result_alter() function in my existing module.
The above code adds additional data to my search results variables. I then implemented a hook_preprocess_search_result() function in my theme’s template.php file to pass this data to the search-result.tpl.php template file.
And in my theme’s search-result.tpl.php template file, I added the following PHP to show the new variable.
I also added a few lines of CSS in my theme’s style.css file to tidy up the layout.
The visual results can be seen here on my photo gallery.