/****************************************************************************** * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */ /*! \page extsearch External Indexing and Searching [TOC] \section extsearch_intro Introduction With release 1.8.3, doxygen provides the ability to search through HTML using an external indexing tool and search engine. This has several advantages: - For large projects it can have significant performance advantages over doxygen's built-in search engine, as doxygen uses a rather simple indexing algorithm. - It allows combining the search data of multiple projects into one index, allowing a global search across multiple doxygen projects. - It allows adding additional data to the search index, i.e. other web pages not produced by doxygen. - The search engine needs to run on a web server, but clients can still browse the web pages locally. To avoid that everyone has to start writing their own indexer and search engine, doxygen provides an example tool for each action: `doxyindexer` for indexing the data and `doxysearch.cgi` for searching through the index. The data flow is shown in the following diagram: \image html extsearch_flow.png "External Search Data Flow" \image latex extsearch_flow.eps "External Search Data Flow" height=10cm - `doxygen` produces the raw search data - `doxyindexer` indexes the data into a search database `doxysearch.db` - when a user performs a search from a doxygen generated HTML page, the CGI binary `doxysearch.cgi` will be invoked. - the `doxysearch.cgi` tool will perform a query on the database and return the results. - The browser will show the search results. \section extsearch_config Configuring The first step is to make the search engine available via a web server. If you use `doxysearch.cgi` this means making the CGI binary available from the web server (i.e. be able to run it from a browser via an URL starting with http:) How to setup a web server is outside the scope of this document, but if you for instance have Apache installed, you could simply copy the `doxysearch.cgi` file from doxygen's `bin` dir to the `cgi-bin` of the Apache web server. Read the apache documentation for details. To test if `doxysearch.cgi` is accessible start your web browser and point to URL to the binary and add `?test` at the end http://yoursite.com/path/to/cgi/doxysearch.cgi?test You should get the following message: Test failed: cannot find search index doxysearch.db If you use Internet Explorer you may be prompted to download a file, which will then contain this message. Since we didn't create or install a doxysearch.db it is ok for the test to fail for this reason. How to correct this is discussed in the next section. Before continuing with the next section add the above URL (without the `?test` part) to the `SEARCHENGINE_URL` tag in doxygen's configuration file: SEARCHENGINE_URL = http://yoursite.com/path/to/cgi/doxysearch.cgi \subsection extsearch_single Single project index To use the external search option, make sure the following options are enabled in doxygen's configuration file: SEARCHENGINE = YES SERVER_BASED_SEARCH = YES EXTERNAL_SEARCH = YES This will make doxygen generate a file called `searchdata.xml` in the output directory (configured with \ref cfg_output_directory "OUTPUT_DIRECTORY"). You can change the file name (and location) with the \ref cfg_searchdata_file "SEARCHDATA_FILE" option. The next step is to put the raw search data into an index for efficient searching. You can use `doxyindexer` for this. Simply run it from the command line: doxyindexer searchdata.xml This will create a directory called `doxysearch.db` with some files in it. By default the directory will be created at the location from which doxyindexer was started, but you can change the directory using the `-o` option. Copy the `doxysearch.db` directory to the same directory as where the `doxysearch.cgi` is located and rerun the browser test by pointing the browser to http://yoursite.com/path/to/cgi/doxysearch.cgi?test You should now get the following message: Test successful. Now you should be enable to search for words and symbols from the HTML output. \subsection extsearch_multi Multi project index In case you have more than one doxygen project and these projects are related, it may be desirable to allow searching for words in all projects from within the documentation of any of the projects. To make this possible all that is needed is to combine the search data for all projects into a single index, e.g. for two projects A and B for which the searchdata.xml is generated in directories project_A and project_B run: doxyindexer project_A/searchdata.xml project_B/searchdata.xml and then copy the resulting `doxysearch.db` to the directory where also `doxysearch.cgi` is located. The `searchdata.xml` file doesn't contain any absolute paths or links, so how can the search results from multiple projects be linked back to the right documentation set? This is where the `EXTERNAL_SEARCH_ID` and `EXTRA_SEARCH_MAPPINGS` options come into play. To be able to identify the different projects, one needs to set a unique ID using \ref cfg_external_search_id "EXTERNAL_SEARCH_ID" for each project. To link the search results to the right project, you need to define a mapping per project using the \ref cfg_extra_search_mappings "EXTRA_SEARCH_MAPPINGS" tag. With this option to can define the mappin# # Copyright (c) 2001, 2002, 2003 Steven Knight # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Script.SConscript # all of the SConscript.py tests are in test/SConscript.py