Thursday, April 28, 2011

Is it possible with Views module to create a search and results page?

I know Drupal has built in search module, but I want more flexibility and control. Is it possible using Views to create the search form and results pages?

From stackoverflow
  • Sure. There's two ways. One is to use Views filters: just create the view for the results page, add a filter, and expose the filter. You can create a search block by checking the option to create a block for the exposed form in the Views settings. Load the Advanced Help module for more information about Views filters.

    The other way is to use Apache Solr and the Apache Solr Views module. Same idea as just using Views filters, but it'll use the Solr search backend instead of just doing SQL queries to the database.

    Tim : Thanks again Mark, this has put me on the right track. Currently the search block is submitting to my home page and adding the search term onto the query string, is this the intended behaviour? I have the search block appearing in a panel what I would like to happen after the user submits it is it submits the search query to another page/panel with the results view
    Mark Trapp : I'm not familiar with how Panels works, so it could be interfering with the exposed filter block. Outside of that, if you have a page display in a view with exposed filters in a block, the intended functionality is that when you submit the form in the block it takes you to the page from which the block is derived regardless of where the block is.
    Tim : Actually, I didnt have a page display, once I set it to page, it worked fine. cheers.

0 comments:

Post a Comment