15
               

I am having drupal 7 site with search enabled. I want to restrict the search to a particular content type/types, by excluding which types i dont want to appear in the result. How can i do this?

And can i also disable the advance search feature? Are there any module for this?

                                   
Improve this question                                    
       

4 Answers 正确答案

ActiveOldestVotes                    
       
15
                   

I guess that Custom Search module can help you: http://drupal.org/project/custom_search. acording Custom Search module description:

The module adds options to select:

* which content type(s) to search
                       

here a snapshot of Custom Search settings related with content type configuration:

enter image description here                        

Other alternative seems to be Search Configuration module http://drupal.org/project/search_config that give to Search settings (in Additional Node Search Configuration > Only of the type(s) settings) options to filter search by content type:

enter image description here                        

                                       
Improve this answer                                        
       
5
                   

you could just add a view with the title as an "exposed filter". Then you can limit the search to certain nodes.

                                       
Improve this answer                                        
       
5
                   

Drupal's contrib module Search Restrict is a lightweight module that just does the basics - it allows administrators to restrict by role who can search for each content type.

From the module's page:

Approach of this module is to re-write the search query, so that content is indexed and available as search results to users in role(s) that have permissions to view it, but not displayed to other roles. Integrates with Apache Solr to exclude results based on the role of the person searching.

Simply download, install, and enable the module. Then to restrict (by role) which users can search which content types, edit each Content Type individually and there will now be a 'Search Restrict' section option (below the Display Settings). It allows you to specific, for each content type, which roles can search nodes of that content type.

                                       
Improve this answer                                        
       
1
                   

My evaluated best solution uses all content types in search config and lets you exclude the unwanted types: https://www.lullabot.com/articles/hiding-content-from-drupals-search-system                        

                                       
Improve this answer                                        
       

Your Answer


           

来自  https://drupal.stackexchange.com/questions/12011/restrict-drupal-search-to-few-content-types            

https://www.drupal.org/forum/support/post-installation/2011-05-19/only-search-certain-certain-content-types-in-drupal-7