144N/AThe contents of this file are subject to the terms of the
1281N/ACommon Development and Distribution License (the "License").
144N/AYou may not use this file except in compliance with the License.
144N/Alanguage governing permissions and limitations under the License.
144N/AWhen distributing Covered Code, include this CDDL HEADER in each
144N/AIf applicable, add the following below this CDDL HEADER, with the
144N/Afields enclosed by brackets "[]" replaced with your own identifying
144N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
144N/ACopyright 2007 Sun Microsystems, Inc. All rights reserved.
144N/AUse is subject to license terms.
1186N/APortions Copyright 2011 Jens Elkner.
1364N/A<body class="yui3-skin-sam">
1186N/AA <dfn>Query</dfn> is a series of clauses. A clause may be prefixed by:</p>
1281N/A <li>a plus "<b>+</b>" or a minus "<b>-</b>" sign, indicating that the clause
1281N/A is required or prohibited respectively; or</li>
1281N/A <li>a <dfn>term</dfn> followed by a colon "<b>:</b>", indicating the
1281N/A <dfn>field</dfn> to be searched. This enables one to construct queries
1281N/A which search multiple <dfn>fields</dfn>.</li>
1186N/A<p>A clause may be either:</p>
1281N/A <li>a <dfn>term</dfn>, indicating all the documents that contain this term;
1281N/A <li>a <dfn>phrase</dfn> - group of words surrounded by double quotes
1281N/A <li>a nested query, enclosed in parentheses "<b>(</b>" "<b>)</b>" (also
1281N/A with a +/- prefix to require any of a set of terms. </li>
1281N/A <li>boolean <dfn>operators</dfn> which allow terms to be combined through
1281N/A logic operators. Supported are <b>AND</b>(<b>&&</b>), "<b>+</b>",
1281N/A <b>OR</b>(<b>||</b>), <b>NOT</b>(<b>!</b>) and "<b>-</b>" (Note: they
1186N/A<p>Wildcard, Fuzzy, Proximity & Range Searches:</p>
1281N/A <li>to perform a single character wildcard search use the "<b>?</b>" symbol,
1281N/A <li>to perform a multiple character wildcard search use the "<b>*</b>"
1281N/A <li>you cannot use a * or ? symbol as the first character of a search
1281N/A (unless enabled using indexer option -a).</li>
1281N/A <li>to do a fuzzy search(find words similar in spelling, based on the
1281N/A Levenshtein Distance, or Edit Distance algorithm) use the tilde,
1281N/A <li>to do a proximity search use the tilde, "~", symbol at the end of a
1281N/A Phrase. For example to search for a "opengrok" and "help" within 10
1281N/A words of each other enter: "opengrok help"~10 </li>
1281N/A <li>range queries allow one to match documents whose field(s) values are
1281N/A between the lower and upper bound specified by the Range Query. Range
1281N/A Queries can be inclusive or exclusive of the upper and lower bounds.
1281N/A Sorting is done lexicographically. Inclusive queries are denoted by
1281N/A square brackets <b>[ ]</b> , exclusive by curly brackets <b>{ }</b>.
1281N/A For example: title:{Aida TO Carmen} - will find all documents between
1281N/A Aida to Carmen, exclusive of Aida and Carmen. </li>
1186N/A<a id="escaping"><dfn>Escaping special characters:</dfn></a>
1281N/A<p>Opengrok supports escaping special characters that are part of the query
1281N/A syntax. Current special characters are:<br/>
1186N/A <b>+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ </b><br/>
1281N/ATo escape these character use the \ before the character. For example to search
1186N/Afor <b>(1+1):2</b> use the query: <b>\(1\+1\)\:2</b>
1281N/A<p>NOTE on analyzers: Indexed words are made up of Alpha-Numeric and Underscore
1186N/Acharacters. One letter words are usually not indexed as symbols!<br/>
1281N/AMost other characters(including single and double quotes) are treated as
1186N/Amost analyzers ignore them). <br/>
1281N/AThe exceptions are: <b>@ $ % ^ & = ? . :</b> which are mostly indexed as
1281N/ABecause some of them are part of the query syntax, they must be escaped with a
1186N/Areverse slash as noted above.<br/>
1120N/ASo searching for <b>\+1</b> or <b>\+ 1</b> will both find <b>+1</b> and <b>+ 1</b>.
1186N/A<p>valid <dfn>FIELDs</dfn> are</p>
1186N/A<dd>Search through all text tokens(words,strings,identifiers,numbers) in index.</dd>
1186N/A<dd>Only finds symbol definitions.</dd>
1186N/A<dd>Only finds symbols.</dd>
1186N/A<dd>path of the source file.</dd>
1186N/A<dd>History log comments.</dd>
1281N/Athe term(phrases) can be boosted (making it more relevant) using a caret
1186N/A<b>^</b> ,
e.g. help^4 opengrok - will make term help boosted
1281N/ATo find where setResourceMonitors is defined: <a
1419N/Ahref="<%= prefix %>q=&defs=setResourceMonitors">defs:setResourceMonitors</a>
1186N/ATo find assignments to variable Asign:
1469N/A<a href="<%= prefix %>q=%22asign=%22">"Asign="</a>
1281N/ATo find Makefiles where pstack binary is being built:
1419N/A<a href="<%= prefix %>q=pstack&path=Makefile">pstack path:Makefile</a>
1281N/Ato search for phrase "Bill Joy":
1469N/A<a href="<%= prefix %>q=%22Bill%20Joy%22">"Bill Joy"</a>
1186N/ATo find all strings begining with foo use the wildcard:
1419N/A<a href="<%= prefix %>q=foo*">foo*</a>
1278N/ATo find all files which have . c in their name(dot is a token!):
1469N/A<a href="<%= prefix %>path=%22.%20c%22">". c"</a>
1186N/A>lucene</a>, for more detail on query syntax refer to lucene docs.</p>