Merge "removed vFW vLB extra executables"
[demo.git] / VES5.0 / doxygen-1.8.12 / html / extsearch.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.12"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>Doxygen: External Indexing and Searching</title>
9 <link href="tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <link href="navtree.css" rel="stylesheet" type="text/css"/>
13 <script type="text/javascript" src="resize.js"></script>
14 <script type="text/javascript" src="navtreedata.js"></script>
15 <script type="text/javascript" src="navtree.js"></script>
16 <script type="text/javascript">
17   $(document).ready(initResizable);
18 </script>
19 <link href="doxygen_manual.css" rel="stylesheet" type="text/css" />
20 </head>
21 <body>
22 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
23 <div id="titlearea">
24 <table cellspacing="0" cellpadding="0">
25  <tbody>
26  <tr style="height: 56px;">
27   <td id="projectalign" style="padding-left: 0.5em;">
28    <div id="projectname">Doxygen
29    </div>
30   </td>
31  </tr>
32  </tbody>
33 </table>
34 </div>
35 <!-- end header part -->
36 <!-- Generated by Doxygen 1.8.12 -->
37 </div><!-- top -->
38 <div id="side-nav" class="ui-resizable side-nav-resizable">
39   <div id="nav-tree">
40     <div id="nav-tree-contents">
41       <div id="nav-sync" class="sync"></div>
42     </div>
43   </div>
44   <div id="splitbar" style="-moz-user-select:none;" 
45        class="ui-resizable-handle">
46   </div>
47 </div>
48 <script type="text/javascript">
49 $(document).ready(function(){initNavTree('extsearch.html','');});
50 </script>
51 <div id="doc-content">
52 <div class="header">
53   <div class="headertitle">
54 <div class="title">External Indexing and Searching </div>  </div>
55 </div><!--header-->
56 <div class="contents">
57 <div class="toc"><h3>Table of Contents</h3>
58 <ul><li class="level1"><a href="#extsearch_intro">Introduction</a></li>
59 <li class="level1"><a href="#extsearch_config">Configuring</a><ul><li class="level2"><a href="#extsearch_single">Single project index</a></li>
60 <li class="level2"><a href="#extsearch_multi">Multi project index</a></li>
61 </ul>
62 </li>
63 <li class="level1"><a href="#extsearch_update">Updating the index</a></li>
64 <li class="level1"><a href="#extsearch_api">Programming interface</a><ul><li class="level2"><a href="#extsearch_api_index">Indexer input format</a></li>
65 <li class="level2"><a href="#extsearch_api_search_in">Search URL format</a></li>
66 <li class="level2"><a href="#extsearch_api_search_out">Search results format</a></li>
67 </ul>
68 </li>
69 </ul>
70 </div>
71 <div class="textblock"><h1><a class="anchor" id="extsearch_intro"></a>
72 Introduction</h1>
73 <p>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:</p><ul>
74 <li>For large projects it can have significant performance advantages over doxygen's built-in search engine, as doxygen uses a rather simple indexing algorithm.</li>
75 <li>It allows combining the search data of multiple projects into one index, allowing a global search across multiple doxygen projects.</li>
76 <li>It allows adding additional data to the search index, i.e. other web pages not produced by doxygen.</li>
77 <li>The search engine needs to run on a web server, but clients can still browse the web pages locally.</li>
78 </ul>
79 <p>To avoid that everyone has to start writing their own indexer and search engine, doxygen provides an example tool for each action: <code>doxyindexer</code> for indexing the data and <code>doxysearch.cgi</code> for searching through the index.</p>
80 <p>The data flow is shown in the following diagram:</p>
81 <div class="image">
82 <img src="extsearch_flow.png" alt="extsearch_flow.png"/>
83 <div class="caption">
84 External Search Data Flow</div></div>
85 <ul>
86 <li><code>doxygen</code> produces the raw search data</li>
87 <li><code>doxyindexer</code> indexes the data into a search database <code>doxysearch.db</code></li>
88 <li>when a user performs a search from a doxygen generated HTML page, the CGI binary <code>doxysearch.cgi</code> will be invoked.</li>
89 <li>the <code>doxysearch.cgi</code> tool will perform a query on the database and return the results.</li>
90 <li>The browser will show the search results.</li>
91 </ul>
92 <h1><a class="anchor" id="extsearch_config"></a>
93 Configuring</h1>
94 <p>The first step is to make the search engine available via a web server. If you use <code>doxysearch.cgi</code> this means making the <a href="http://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a> binary available from the web server (i.e. be able to run it from a browser via an URL starting with http:)</p>
95 <p>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 <code>doxysearch.cgi</code> file from doxygen's <code>bin</code> dir to the <code>cgi-bin</code> of the Apache web server. Read the <a href="http://httpd.apache.org/docs/2.2/howto/cgi.html">apache documentation</a> for details.</p>
96 <p>To test if <code>doxysearch.cgi</code> is accessible start your web browser and point to URL to the binary and add <code>?test</code> at the end </p><pre class="fragment">http://yoursite.com/path/to/cgi/doxysearch.cgi?test
97 </pre><p>You should get the following message: </p><pre class="fragment">Test failed: cannot find search index doxysearch.db
98 </pre><p>If you use Internet Explorer you may be prompted to download a file, which will then contain this message.</p>
99 <p>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.</p>
100 <p>Before continuing with the next section add the above URL (without the <code>?test</code> part) to the <code>SEARCHENGINE_URL</code> tag in doxygen's configuration file: </p><pre class="fragment">SEARCHENGINE_URL = http://yoursite.com/path/to/cgi/doxysearch.cgi
101 </pre><h2><a class="anchor" id="extsearch_single"></a>
102 Single project index</h2>
103 <p>To use the external search option, make sure the following options are enabled in doxygen's configuration file: </p><pre class="fragment">SEARCHENGINE           = YES
104 SERVER_BASED_SEARCH    = YES
105 EXTERNAL_SEARCH        = YES
106 </pre><p>This will make doxygen generate a file called <code>searchdata.xml</code> in the output directory (configured with <a class="el" href="config.html#cfg_output_directory">OUTPUT_DIRECTORY</a>). You can change the file name (and location) with the <a class="el" href="config.html#cfg_searchdata_file">SEARCHDATA_FILE</a> option.</p>
107 <p>The next step is to put the raw search data into an index for efficient searching. You can use <code>doxyindexer</code> for this. Simply run it from the command line: </p><pre class="fragment">doxyindexer searchdata.xml
108 </pre><p>This will create a directory called <code>doxysearch.db</code> 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 <code>-o</code> option.</p>
109 <p>Copy the <code>doxysearch.db</code> directory to the same directory as where the <code>doxysearch.cgi</code> is located and rerun the browser test by pointing the browser to </p><pre class="fragment">http://yoursite.com/path/to/cgi/doxysearch.cgi?test
110 </pre><p>You should now get the following message: </p><pre class="fragment">Test successful.
111 </pre><p>Now you should be able to search for words and symbols from the HTML output.</p>
112 <h2><a class="anchor" id="extsearch_multi"></a>
113 Multi project index</h2>
114 <p>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.</p>
115 <p>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: </p><pre class="fragment">doxyindexer project_A/searchdata.xml project_B/searchdata.xml
116 </pre><p>and then copy the resulting <code>doxysearch.db</code> to the directory where also <code>doxysearch.cgi</code> is located.</p>
117 <p>The <code>searchdata.xml</code> 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 <code>EXTERNAL_SEARCH_ID</code> and <code>EXTRA_SEARCH_MAPPINGS</code> options come into play.</p>
118 <p>To be able to identify the different projects, one needs to set a unique ID using <a class="el" href="config.html#cfg_external_search_id">EXTERNAL_SEARCH_ID</a> for each project.</p>
119 <p>To link the search results to the right project, you need to define a mapping per project using the <a class="el" href="config.html#cfg_extra_search_mappings">EXTRA_SEARCH_MAPPINGS</a> tag. With this option to can define the mapping from IDs of other projects to the (relative) location of documentation of those projects.</p>
120 <p>So for projects A and B the relevant part of the configuration file could look as follows: </p><pre class="fragment">project_A/Doxyfile
121 ------------------
122 EXTERNAL_SEARCH_ID    = A
123 EXTRA_SEARCH_MAPPINGS = B=../../project_B/html
124 </pre><p>for project A and for project B </p><pre class="fragment">project_B/Doxyfile
125 ------------------
126 EXTERNAL_SEARCH_ID    = B
127 EXTRA_SEARCH_MAPPINGS = A=../../project_A/html
128 </pre><p>with these settings, projects A and B can share the same search database, and the search results will link to the right documentation set.</p>
129 <h1><a class="anchor" id="extsearch_update"></a>
130 Updating the index</h1>
131 <p>When you modify the source code, you should re-run doxygen to get up to date documentation again. When using external searching you also need to update the search index by re-running <code>doxyindexer</code>. You could wrap the call to doxygen and doxyindexer together in a script to make this process easier.</p>
132 <h1><a class="anchor" id="extsearch_api"></a>
133 Programming interface</h1>
134 <p>Previous sections have assumed you use the tools <code>doxyindexer</code> and <code>doxysearch.cgi</code> to do the indexing and searching, but you could also write your own index and search tools if you like.</p>
135 <p>For this 3 interfaces are important</p><ul>
136 <li>The format of the input for the index tool.</li>
137 <li>The format of the input for the search engine.</li>
138 <li>The format of the output of search engine.</li>
139 </ul>
140 <p>The next subsections describe these interfaces in more detail.</p>
141 <h2><a class="anchor" id="extsearch_api_index"></a>
142 Indexer input format</h2>
143 <p>The search data produced by doxygen follows the <a href="http://wiki.apache.org/solr/UpdateXmlMessages">Solr XML index message</a> format.</p>
144 <p>The input for the indexer is an XML file, which consists of one <code>&lt;add&gt;</code> tag containing multiple <code>&lt;doc&gt;</code> tags, which in turn contain multiple <code>&lt;field&gt;</code> tags.</p>
145 <p>Here is an example of one doc node, which contains the search data and meta data for one method: </p><pre class="fragment">&lt;add&gt;
146   ...
147   &lt;doc&gt;
148     &lt;field name="type"&gt;function&lt;/field&gt;
149     &lt;field name="name"&gt;QXmlReader::setDTDHandler&lt;/field&gt;
150     &lt;field name="args"&gt;(QXmlDTDHandler *handler)=0&lt;/field&gt;
151     &lt;field name="tag"&gt;qtools.tag&lt;/field&gt;
152     &lt;field name="url"&gt;de/df6/class_q_xml_reader.html#a0b24b1fe26a4c32a8032d68ee14d5dba&lt;/field&gt;
153     &lt;field name="keywords"&gt;setDTDHandler QXmlReader::setDTDHandler QXmlReader&lt;/field&gt;
154     &lt;field name="text"&gt;Sets the DTD handler to handler DTDHandler()&lt;/field&gt;
155   &lt;/doc&gt;
156   ...
157 &lt;/add&gt;
158 </pre><p>Each field has a name. The following field names are supported:</p><ul>
159 <li><em>type</em>: the type of the search entry; can be one of: source, function, slot, signal, variable, typedef, enum, enumvalue, property, event, related, friend, define, file, namespace, group, package, page, dir</li>
160 <li><em>name</em>: the name of the search entry; for a method this is the qualified name of the method, for a class it is the name of the class, etc.</li>
161 <li><em>args</em>: the parameter list (in case of functions or methods)</li>
162 <li><em>tag</em>: the name of the tag file used for this project.</li>
163 <li><em>url</em>: the (relative) URL to the HTML documentation for this entry.</li>
164 <li><em>keywords</em>: important words that are representative for the entry. When searching for such keyword, this entry should get a higher rank in the search results.</li>
165 <li><em>text</em>: the documentation associated with the item. Note that only words are present, no markup.</li>
166 </ul>
167 <dl class="section note"><dt>Note</dt><dd>Due to the potentially large size of the XML file, it is recommended to use a <a href="http://en.wikipedia.org/wiki/Simple_API_for_XML">SAX based parser</a> to process it.</dd></dl>
168 <h2><a class="anchor" id="extsearch_api_search_in"></a>
169 Search URL format</h2>
170 <p>When the search engine is invoked from a doxygen generated HTML page, a number of parameters are passed to via the <a href="http://en.wikipedia.org/wiki/Query_string">query string</a>.</p>
171 <p>The following fields are passed:</p><ul>
172 <li><em>q</em>: the query text as entered by the user</li>
173 <li><em>n</em>: the number of search results requested.</li>
174 <li><em>p</em>: the number of search page for which to return the results. Each page has <em>n</em> values.</li>
175 <li><em>cb</em>: the name of the callback function, used for JSON with padding, see the next section.</li>
176 </ul>
177 <p>From the complete list of search results, the range <code>[n*p - n*(p+1)-1]</code> should be returned.</p>
178 <p>Here is an example of how a query looks like. </p><pre class="fragment">http://yoursite.com/path/to/cgi/doxysearch.cgi?q=list&amp;n=20&amp;p=1&amp;cb=dummy
179 </pre><p>It represents a query for the word 'list' (<code>q=list</code>) requesting 20 search results (<code>n=20</code>), starting with the result number 20 (<code>p=1</code>) and using callback 'dummy' (<code>cb=dummy</code>):</p>
180 <dl class="section note"><dt>Note</dt><dd>The values are <a href="http://en.wikipedia.org/wiki/Percent-encoding">URL encoded</a> so they have to be decoded before they can be used.</dd></dl>
181 <h2><a class="anchor" id="extsearch_api_search_out"></a>
182 Search results format</h2>
183 <p>When invoking the search engine as shown in the previous subsection, it should reply with the results. The format of the reply is <a href="http://en.wikipedia.org/wiki/JSONP">JSON with padding</a>, which is basically a javascript struct wrapped in a function call. The name of function should be the name of the callback (as passed with the <em>cb</em> field in the query).</p>
184 <p>With the example query as shown the previous subsection the main structure of the reply should look as follows: </p><pre class="fragment">dummy({
185   "hits":179,
186   "first":20,
187   "count":20,
188   "page":1,
189   "pages":9,
190   "query": "list",
191   "items":[
192   ...
193  ]})
194 </pre><p>The fields have the following meaning:</p><ul>
195 <li><em>hits</em>: the total number of search results (could be more than was requested).</li>
196 <li><em>first</em>: the index of first result returned: <img class="formulaInl" alt="$\min(n*p,\mbox{\em hits})$" src="form_6.png"/>.</li>
197 <li><em>count</em>: the actual number of results returned: <img class="formulaInl" alt="$\min(n,\mbox{\em hits}-\mbox{\em first})$" src="form_7.png"/></li>
198 <li><em>page</em>: the page number of the result: <img class="formulaInl" alt="$p$" src="form_8.png"/></li>
199 <li><em>pages</em>: the total number of pages: <img class="formulaInl" alt="$\lceil\frac{\mbox{\em hits}}{n}\rceil$" src="form_9.png"/>.</li>
200 <li><em>items</em>: an array containing the search data per result.</li>
201 </ul>
202 <p>Here is an example of how the element of the <em>items</em> array should look like: </p><pre class="fragment">{"type": "function",
203  "name": "QDir::entryInfoList(const QString &amp;nameFilter, int filterSpec=DefaultFilter, int sortSpec=DefaultSort) const",
204  "tag": "qtools.tag",
205  "url": "d5/d8d/class_q_dir.html#a9439ea6b331957f38dbad981c4d050ef",
206  "fragments":[
207    "Returns a &lt;span class=\"hl\"&gt;list&lt;/span&gt; of QFileInfo objects for all files and directories...",
208    "... pointer to a QFileInfoList The &lt;span class=\"hl\"&gt;list&lt;/span&gt; is owned by the QDir object...",
209    "... to keep the entries of the &lt;span class=\"hl\"&gt;list&lt;/span&gt; after a subsequent call to this..."
210  ]
211 },
212 </pre><p>The fields for such an item have the following meaning:</p><ul>
213 <li><em>type</em>: the type of the item, as found in the field with name "type" in the raw search data.</li>
214 <li><em>name</em>: the name of the item, including the parameter list, as found in the fields with name "name" and "args" in the raw search data.</li>
215 <li><em>tag</em>: the name of the tag file, as found in the field with name "tag" in the raw search data.</li>
216 <li><em>url</em>: the name of the (relative) URL to the documentation, as found in the field with name "url" in the raw search data.</li>
217 <li>"fragments": an array with 0 or more fragments of text containing words that have been search for. These words should be wrapped in <code>&lt;span class="hl"&gt;</code> and <code>&lt;/span&gt;</code> tags to highlight them in the output. </li>
218 </ul>
219 </div></div><!-- contents -->
220 </div><!-- doc-content -->
221 <!-- start footer part -->
222 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
223   <ul>
224     <li class="footer">Generated by
225     <a href="http://www.doxygen.org/index.html">
226     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
227   </ul>
228 </div>
229 </body>
230 </html>