I'm using the search core module together with the search_config (http://drupal.org/project/search_config) module. The latter (also) adds possibility to exclude particular node types from the search.

Is it possible to have more than one search field/block per website?

I need to have a search field that only search for "news" content type, another one that only search for "associations" content type, and so on...

Thank you.

Comments

scoutbaker’s picture

Try the Multiblock module.

samchok’s picture

Thank you for your suggestion.
I've created an instance of the "search form" block but I can't give it different settings because all the search setting (admin/settings/search) seems to be global.

Anyway, what I need to do is exactly what is already present in the drupal.org website: a search form is always present in the top-right corner of the website, but in the Modules page another search form is present and it only searches for modules.
That's exactly what I need to do.

amabes1012’s picture

Multiple Search fields for different Content Types

We are going to create 2 php pages to hold our search forms.
The forms use a hidden input value giving us the functionality of only searching the "News" and "Assosciations" content types.

1. Uninstall Search Config or whatever that module is...

------- NEWS --------

2. Create a new blank PHP page and paste the following code:


<div id="site_searcher">

<form action="/search/node" method="get" id="search-form" class="search-form">

<input type="text" class="swap_value" value="Enter Search Terms" size="25" name="keys" id="searchField"/>
<input type="submit" class="searchButton" value="Search" name="op" title="Search" alt="Search" width="40" height="24" />

<input type="hidden" value="<?php print drupal_get_token('search_form'); ?>" name="form_token" />
<input type="hidden" value="search_form" id="edit-search-form" name="form_id" />
<input type="hidden" name="type[news]" id="edit-type-news" value="news"  />

<!--<input type="hidden" name="type[your_content_type]" id="edit-type-your_content_type" value="your_content_type"  />-->

</form>

</div>

3. Save it as site_searcher_news.php ( in the same directory as page.tpl.php )

4. Now open page.tpl.php and paste the following code:


<?php include ('site_searcher_news.php') ?>

------ ASSOCIATIONS --------

5. Create a new blank PHP page and paste the following code:


<div id="site_searcher">

<form action="/search/node" method="get" id="search-form" class="search-form">

<input type="text" class="swap_value" value="Enter Search Terms" size="25" name="keys" id="searchField"/>
<input type="submit" class="searchButton" value="Search" name="op" title="Search" alt="Search" width="40" height="24" />

<input type="hidden" value="<?php print drupal_get_token('search_form'); ?>" name="form_token" />
<input type="hidden" value="search_form" id="edit-search-form" name="form_id" />
<input type="hidden" name="type[associations]" id="edit-type-associations" value="associations"  />


<!--<input type="hidden" name="type[your_content_type]" id="edit-type-your_content_type" value="your_content_type"  />-->


</form>

</div>

6. Save it as site_searcher_associations.php ( in the same directory as page.tpl.php )

4. Now open page.tpl.php and paste the following code:


<?php include ('site_searcher_associations.php') ?>

Good Luck - [BD] BREAKING DEVELOPMENT