I have two type of content lets say News and Article. Now, I want search over these two content types(option is given to user). I am using default search module of drupal. I am able to search both by www.example.com/search/node/ but unable to filter out because I don't know how to provide content type here.

My question is :

How to provide search parameters (like content type) to URL so that my search works correctly according to content type?

I try to provide www.example.com/search/node/[content type]/[search pattern] then "[content type]/[search pattern]" become actual search pattern. What are the options I have.

If URL change is not the solution what are the options I have to resolve the issue.

Regards, Yatendra.

  • Which version of Drupal are you using?
    – ratface
    Apr 30 '14 at 16:29
  • i am using drupal 7.. May 1 '14 at 5:38

You could make the same search with a view and add contextual filter to achieve the specific URL pattern and normal field filters to apply other filtration if needed. The view could render the node with the same display that you was going to use for the default search so if you have already built the markup - you don't have to do it again.

Edit: Also if you want to use the default search api - you could make a facet to filter with the help of the Facet API Module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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