A feature request for one of my recent projects was an “Advanced Search” functionality, similar to the ones that is commonly found in social networking and personal sites. Rather than creating a completely custom search form using Drupal’s Forms API, I decided to create a module called “Views Search” which uses the Views module and allows anyone to create advanced searches for anything Views can process without custom coding.
Views’ exposed filter work very similar to the search functionality, however exposed filters in the Views module work like true filters, where a list of nodes is limited down to the intended results using a combination of several filters. In contrast to this approach, a more traditional search form allows users to define all criteria first (before seeing any results) and then click on a “Search” button to see the results. This module allows site administrators to easily use the behavior of a traditional search for selected views.
In addition, the Views Search module allows Drupal site members to save their searches for future usage.
Here’s an overview of the feature set:
- Separates the search form and results: selected views show a search form without showing the results on the first page and the search results without showing the search form/filters on the following pages
- Allows users to start over with a search (using a button on search results page)
- Allows users to modify the search criteria (using a button on the search results page that expands search criteria using jQuery)
- Allows users to save a set of search criteria for later usage
- Allows users to modify/overwrite the name and search criteria for a saved search
- Provides a default view that allows the current user to manage saved searches
- Provides a block showing a drop-down with saved searches for the current user
- Enables site administrators to select views that should act like “search views”
- Enables site administrators to limit the number of saved searches for certain user roles & set saved search limits per rule
- Enables site administrators to batch-delete all saved searches for a specific view
You can download the module from the Views Search Module page on Drupal.org. I’m looking forward to any feedback.