Custom Image Search with Solr, Filefield Sources, and Ctools - Part 3
In our quest to build a custom image search functionality, we are at the last two steps. We have the ability to display a modal window, search for images, and page through the results; now we just need to be able to write the file name and file id back to the source text field so it can be added to the node. Also, in the last post, we just glossed over the code that actually gathers the search parameters and searches Solr, so we will cover that code in detail here.
Custom Image Search with Solr, Filefield Sources, and Ctools - Part 2
Continuing on from my previous post, we are working on building a custom image search in Drupal using Apache Solr, Filefield Sources, and Ctools. So far, we have created our custom FileField Source element that will allow us to search. Now we get to the actual searching functionality. The first thing we need is a modal window that will display our search form and the search results. As mentioned in the first post, our source link has the ctools-use-modal class, which will cause the link to open our page callback in a modal window.
Custom Image Search with Solr, Filefield Sources, and Ctools - Part 1
Over the years I have been a big fan and user of Apache Solr for search on Drupal sites, in particular using the Apache Solr Search set of modules, mostly because of it's speed and ability to create facets for drilling down into search results, along with the flexibilty provided by the module API to customize the functionality as needed. While re-building the NewsBusters site from scratch in D7 last year, one of the issues that the users wanted to address was finding existing images to re-use in blog posts. The existing functionality used a file browsing functionality in the WYSIWYG, and as the number of images added to the site grew, just loading the browser to search for an image could take a few minutes. Another change we were making in the D7 version was storing all of our images on Amazon S3 (using the S3FS module), so I figured that I would take this chance to create a custom image search that used Solr. This would address speed issues, and would also allow the users to index metadata about images that could be used later to search for images.