Search in Website

Frequently Asked Questions

Questions


Answers

How can I prevent a specific folder from being searched?

There are two ways to avoid searching within one or several folders of a website. The simplest and most natural way is during the insertion process of DWBSearchWebsite: all you need to do is include the path to the folder that has to be excluded, in the option "Exclude folders from the search".

The second way is slightly more complex - enter the path to the folder directly in the dwbsearch.php file inside the dwb_search folder. To do that, open the dwbsearch.php in any text editor and modify $config, which defines the search tool's setup. The following code contains an example of a $config variable. It can occur that the $config variable in your code is different from the example, but if you wish to limit the search to one or several folders within your website, the "excluded_list" option must be present.

$config = array(
'extension_list'=>array('htm','html','shtml','php','php3','jsp','asp','pdf','txt','jpg','jpeg','gif','png'),
'search_in_list'=>array('../documentation','../products'),
'excluded_list'=>array('../configuration/')
);

In this example, the search will only be realized in files with extensions html, shtml, php, php3, jsp, asp, pdf, txt, jpg, jpeg, gif, png. Only folders '../documentation' and '../products' will be searched and the folder '../configuration/' is explicitly excluded.

The path to the folders, in the option 'search_in_list' as well as 'excluded_list' , must be relative to the file 'dwbsearch.php'.

How can I limit search to one website folder only?

There are two methods to limit the search to one or several folders within a website.

The easiest way is to define it during the insertion process of DWBSearchWebsite, by using the Setup Option "Limit the search to folders", where the path to the folder in question can be entered.

The other way is a bit more difficult. Enter the path to the folder that you want to be searchable, directly into the dwbsearch.php within the dwb_search folder. To do that, open dwbsearch.php in the text editor of your choice, then modify $config, which defines the setup of your search utility. The code below offers an example of the setup variable $config. You probably will have a code slightly different from the example, but if you wish to limit the search to one (or more than one) folders, the option "search_in_list" must be present.

$config = array(
'extension_list'=>array('htm','html','shtml','php','php3','jsp','asp','pdf','txt','jpg','jpeg','gif','png'),
'search_in_list'=>array('../documentation','../products'),
'excluded_list'=>array('../configuration/')
);

In this example, the search will only be realized in files with extensions html, shtml, php, php3, jsp, asp, pdf, txt, jpg, jpeg, gif, png. Only folders '../documentation' and '../products' will be searchable and the folder '../configuration/' is excluded from search.

The path to the folders, in the option 'search_in_list' as well as 'excluded_list' , must be relative to the file 'dwbsearch.php'.

How can I exclude a particular kind of file from search?

For the Search tool, the files are represented by their extension. Adding or deleting a file extension type from the list, you can either allow or disallow searching a specific group of files. There are two ways to prohibit search of a certain type of files.

The simplest way is to define the allowed file extensions during the insertion of DWBSearchWebsite - a special Setup Feature allows to eliminate the file extensions you wish from the allowed list, so they do not show up in searches.

The second method is more tricky. Eliminate the file extension(s) that should be avoided in searches, directly in the code of the dwbsearch.php file, inside dwb_search folder. To do that, open the dwbsearch.php file in any text editor and modify $config, which defines the search tool's configuration. The following code is an example of the $config variable; it could be that yours is slightly different.

$config = array(
'extension_list'=>array('htm','html','shtml','php','php3','jsp','asp','pdf','txt','jpg','jpeg','gif','png'),
'search_in_list'=>array('../documentation','../products'),
'excluded_list'=>array('../configuration/')
);

In this example, the search will be realized in files with extensions html, shtml, php, php3, jsp, asp, pdf, txt, jpg, jpeg, gif, png. Only folders '../documentation' and '../products' are searchable and the folder '../configuration/' is not available to search.

Eliminate from 'extension_list' the extension of files to be excluded in searches.

If in the previous example we wanted to exclude files with images from the search process, the $config object would be:

$config = array(
'extension_list'=>array('htm','html','shtml','php','php3','jsp','asp','pdf','txt'),
'search_in_list'=>array('../documentation','../products'),
'excluded_list'=>array('../configuration/')
);

Extensions jpg, jpeg, gif, png have been deleted from the list.