Manual: Searching

Loading...
Searching...
No Matches
Searching

Doxygen indexes your source code in various ways to make it easier to navigate and find what you are looking for. There are also situations however where you want to search for something by keyword rather than browse for it.

HTML browsers by default have no search capabilities that work across multiple pages, so either Doxygen or external tools need to help to facilitate this feature.

Doxygen has 7 different ways to add searching to the HTML output, each of which has its own advantages and disadvantages:

## 1. Client side searching

The easiest way to enable searching is to enable the built-in client side search engine. This engine is implemented using JavaScript and DHTML only and runs entirely on the clients browser. So no additional tooling is required to make it work.

To enable it set SEARCHENGINE to `YES` in the configuration file and make sure SERVER_BASED_SEARCH is set to `NO`.

An additional advantage of this method is that it provides live searching, i.e. the search results are presented and adapted as you type.

This method also has its drawbacks: it is limited to searching for symbols only. It does not provide full text search capabilities and it does not scale well to very large projects (then searching becomes very slow). Furthermore the searching is done from the beginning of the indexed items, so when having the available items `A_STRING`, `AA_STRING` and `STRING` and typing in the search box `A` it will find `A_STRING` and `AA_STRING`, but when typing e.g. `STR` it will only find `STRING` and not `A_STRING`.

## 2. Server side searching

If you plan to put the HTML documentation on a web server, and that web server has the capability to process PHP code, then you can also use Doxygen's built-in server side search engine.

To enable this set both SEARCHENGINE and SERVER_BASED_SEARCH to `YES` in the configuration file and set EXTERNAL_SEARCH to `NO`.

Advantages over the client side search engine are that it provides full text search and it scales well to medium side projects.

Disadvantages are that it does not work locally (i.e. using a "file://" URL) and that it does not provide live search capabilities.

Note
  In the future this option will probably be replaced by the next search option.

## 3. Server side searching with external indexing

With release 1.8.3 of Doxygen, another server based search option has been added. With this option Doxygen generates the raw data that can be searched and leaves it up to external tools to do the indexing and searching, meaning that you could use your own indexer and search engine of choice. To make life easier Doxygen ships with an example indexer (doxyindexer) and search engine (doxysearch.cgi) based on the Xapian open source search engine library. Both binaries are included in the distribution but not installed by default; they can be manually copied from the `bin` folder to i.e. `/usr/local/bin` or `/var/www/cgi-bin` as desired.

To enable this search method set SEARCHENGINE, SERVER_BASED_SEARCH and EXTERNAL_SEARCH all to `YES`.

See External Indexing and Searching for configuration details.

Advantages over option 2 are that this method (potentially) scales to very large projects. It is also possible to combine multiple Doxygen projects and external data into one search index. The way the interaction with the search engine is done, makes it possible to search from local HTML pages. Also the search results have better ranking and show context information (if available).

Disadvantages are that is requires a web server that can execute a CGI binary, and an additional indexing step after running Doxygen.

## 4. Windows Compiled HTML Help

If you are running Doxygen on Windows, then you can make a compiled HTML Help file (.chm) out of the HTML files produced by Doxygen. This is a single file containing all HTML files and it also includes a search index. There are viewers for this format on many platforms, and Windows even supports it natively.

To enable this set GENERATE_HTMLHELP to `YES` in the configuration file. To let Doxygen compile the HTML Help file for you, you also need to specify the path to the HTML compiler (hhc.exe) using the HHC_LOCATION configuration option and the name of the resulting CHM file using CHM_FILE.

An advantage of this method is that the result is a single file that can easily be distributed. It also provides full text search.

Disadvantages are that compiling the CHM file only works on Windows and requires Microsoft's HTML compiler, which is not very actively supported by Microsoft. Although the tool works fine for most people, it can sometimes crash for no apparent reason (how typical).

## 5. macOS Doc Sets

If you are running Doxygen on macOS 10.5 or higher, then you can make a "doc set" out of the HTML files produced by Doxygen. A doc set consists of a single directory with a special structure containing the HTML files along with a precompiled search index. A doc set can be embedded in Xcode (the integrated development environment provided by Apple).

To enable the creation of doc sets set GENERATE_DOCSET to `YES` in the configuration file. There are a couple of other doc set related options you may want to set. After Doxygen has finished you will find a Makefile in the HTML output directory. Running "make install" on this Makefile will compile and install the doc set. See this article for more info.

Advantage of this method is that it nicely integrates with the Xcode development environment, allowing for instance to click on an identifier in the editor and jump to the corresponding section in the Doxygen documentation.

Disadvantage is that it only works in combination with Xcode on macOS.

## 6. Qt Compressed Help

If you develop for or want to install the Qt application framework, you will get an application called Qt assistant. This is a help viewer for Qt Compressed Help files (`.qch`).

To enable this feature set GENERATE_QHP to `YES`. You also need to fill in the other Qt help related options, such as QHP_NAMESPACE, QHG_LOCATION, QHP_VIRTUAL_FOLDER. See this article for more info.

Feature wise the Qt compressed help feature is comparable with the CHM output, with the additional advantage that compiling the QCH file is not limited to Windows.

Disadvantage is that it requires setting up a Qt 4.5 (or better) for each user, or distributing the Qt help assistant along with the documentation, which is complicated by the fact that it is not available as a separate package at this moment.

## 7. Eclipse Help Plugin

If you use eclipse, you can embed the documentation generated by Doxygen as a help plugin. It will then appear as a topic in the help browser that can be started from "Help contents" in the Help menu. Eclipse will generate a search index for the documentation when you first search for a keyword.

To enable the help plugin set GENERATE_ECLIPSEHELP to `YES`, and define a unique identifier for your project via ECLIPSE_DOC_ID, i.e.:

       GENERATE_ECLIPSEHELP = YES
       ECLIPSE_DOC_ID       = com.yourcompany.yourproject

then create the `com.yourcompany.yourproject` directory (so with the same name as the value of `ECLIPSE_DOC_ID`) in the `plugin` directory of eclipse and after Doxygen completes copy to contents of the help output directory to the `com.yourcompany.yourproject` directory. Then restart eclipse to make let it find the new plugin.

The eclipse help plugin provides similar functionality as the Qt compressed help or CHM output, but it does require that Eclipse is installed and running.

Go to the next section or return to the index.