I read everywhere that it is possible with Views 3 to display search results in a custom view by adding a contextual filter "search: term" to the view and pointing the view's path to "search/node/%". There even used to be a module that added this contextual filter to earlier Views versions: https://drupal.org/project/views_handler_argument_search

Also, see #9 here: https://drupal.org/node/266683

However, I don't have any "search" contextual filters or relations in my view. Was this feature removed again?

Edit: I don't want to search the view once I'm in the view (exposed filters would be the answer in this case). I want to use a view to display the search results of the search form that would be present anywhere on my website. Also, I want to use the indexing feature of Search module instead of using exposed filters. Unfortunately, Apache Solr is not an option.


3 Answers 3

  1. Create a page view called search (Add the fields to display)
  2. Add a path "/search"
  3. Add the contextual filter "Global: null"
  4. Add a filter "Search: search terms", expose the filter.
  5. Expose the form in a block to use the search form elsewhere on your site.

Have you tried to use "exposed filters"?

You can set it in Filter Criteria and then in the Advance column you can set "Exposed form in a block".

  • Yeah, that'd work. But I would also like to use the view to display results of the standard search form.
    – deinqwertz
    Jun 23, 2013 at 15:53
  • drupal.stackexchange.com/questions/4611/… does this help you? Jun 23, 2013 at 15:55
  • I will take a look at it! But I wonder how all the others managed to get that exposed filter running. I am concerned about performance, don't think that exposed filter uses indexing. That's why I want to use the built-in search functionality instead of using an exposed filter.
    – deinqwertz
    Jun 23, 2013 at 16:13
  • Use solr search drupal.org/project/apachesolr. Jun 23, 2013 at 16:23
  • Unfortunately Solr will not be possible on my shared hosting. I have already talked to the company.
    – deinqwertz
    Jun 23, 2013 at 21:19

Create a views with "search" path, add your filters in filter section ( don't use contextual filter") then in advanced ,Exposed form set Exposed form in block to yes then save views, after that the exposed search block will be exist in block list, you can put it in every where you want, when user search something in that block it will redirect to search?title=keyword ( or something like this, I supposed here that you search filter is title)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.