0

I'm starting in on drupal search engine and I am looking to create a search page. First I would like the search is on very specific fields of some content types. What can be done with the basic module "Search" Drupal and "Views"?

Here is a draw of the search page I would like :

enter image description here

Filter 1,2, 3 are checkboxes to filter on content-type after the search.

I have no idea where to start :(.

---------- I add some explanations

I installed the module and SearchAPI followed a tutorial at: http://webwash.net/tutorials/intro-search-api-part-1-how-create-search-pages

This module is very powerful to index only the fields you want, thank you for this discovery. Being an intern student, I am not allowed to release details on what the project, but I'll offer you a similar example.

We have 5 different types of content: car, motorcycle, boat, Helicopter and plane. Each type has common fields and fields of its own.

Car: Name, Brand, Fuel, Transmission Moto: Name, Brand, Fuel, Transmission, Max Speed Boat: Name, Brand, Fuel, GPS Helicopter: Name, Brand, Fuel, Number of propellers Plane: Name, Brand, Fuel, Number of reactors

I want to index Name, Brand, Transmission, Number of propellers, and number of reactors. (I think it's doable quite easily with SearchAPI)

On the drawing on the filter tabs, I would like three tabs: Car, Motorcycle and Other which includes: Boat, Helicopter and Airplane.

By default, the validation of the text field reloads the page, such as a GET or POST form. It reload returns the results for the 5 types of content, so the 3 tabs are checked by default. After reloading, the user can check and uncheck the tabs to filter results by content type (Ajax or simple JS filter on CSS class, I do not know yet).

Another difficulty, my project manager wants the search results are like this:


Title of the node

Field corresponding to the search results. (Can be Name, Brand, Transmission, Number of propellers, or number of reactors)


I hope to enlighten you about my problem. I do not want a ready-made solution, but how to achieve it. Is it doable in the first place ...

  • depending on what the filters actually are, you will likely want to start with Views and go from there - there are dozens of tutorials on setting up searches in Views, and using exposed filters, a simple web search is all that needed – Geoff Jan 30 '15 at 18:26
  • 1
    as a starting point check search_api(drupal.org/project/search_api) module – arpitr Jan 30 '15 at 18:29
  • Thanks, I will check thoose solutions. Keep you in touch ! – Gaius Jan 30 '15 at 21:02
0

You are correct. You could perfectly accomplish this with Views. A simple guide, just for illustration purposes, since we don't have the specifics in your question:

  1. Create a View

  2. In the FILTER CRITERIA section, add the desired filters (make sure to check the "Expose this filter to visitors..." checkbox) by doing that, you are indicating that you want it to be visible in the search page, so your users can change them.

  3. In the OTHER area, mark "Use ajax" as "Yes" to submit the form asynchronously.

  4. In the EXPOSED FORM area, go to "Exposed Form Style" > "Settings" and check the "Autosubmit" checkbox (if you wish to automatically submit the form once an element is changed).

Additionally, you could use the Better Exposed Filters module for advanced cool stuff (E.g. hiding the "Send" button, showing filters as checkboxes, etc).

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.