5,167 Views |
Let’s assume that we have a drupal website and we have search (Search API) option on it. We will do search and drupal will get the search result from index. Now we had a special requirement, i.e we need to exclude a page from search result not a entire content type. This means we need to exclude a page from being searched.
To achieve this we found a module Search Exclude nid, this is usefull if you have very limited no of node to exclude.
If you think you might need to exclude a lot of nodes, better try the other module Search API exclude. This module will give an option for excluding a particular node from search, while you edit the node (node edit form). This module is dependent on Search API module.
First, we need to install and configure search API module, We need to create Search index and server, here you can find the details on how to do it. https://www.drupal.org/node/1251246
After configuring the search API follow the below steps to excluding a node from search.
- Step 1: Download and install Search API exclude in your drupal project.
- Step 2: Goto admin/structure/types and click edit button of the content type which you want to exclude.
- Step 3: When the edit page shows find and click Search API exclude tab in the bottom of the page.
- Step 4: Then click Search API Exclude support checkbox. This will enable exclude option for all the node based on this content type.
- Step 5: Now goto the node page and edit the node. Now goto the bottom of the edit page and find and click “Search API settings” tab.
- Step 6: Click Exclude from Search API checbox and click save button.
- Step 7: To see the result, we must reindex the search. So goto Configuration -> Search API and view the search index which you have created for this site search.
- Step 8: Click Index now button for reindexing. This will take some time.
- Step 9: Now goto your search page created using the Search API and do the search. Now the excluded page won’t available in the search result.