<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html> <head>
<meta http-equiv='CONTENT-TYPE' content='text/html; charset=UTF-8' />
<link rel='StyleSheet' href='DTDDocStyle.css' type='text/css' media='screen' />
<title>Core Lucene</title>
</head><body>
<p class='DTDSource'><b><code>LuceneCoreQuery.dtd</code></b>: <a href='LuceneCoreQuery.dtd.html'>Elements</a> - <a href='LuceneCoreQuery.dtd.entities.html'>Entities</a> - <a href='LuceneCoreQuery.dtd.org.html'>Source</a> | <a href='intro.html'>Intro</a> - <a href='elementsIndex.html'>Index</a><br /><a href='index.html' target='_top'>FRAMES</a>&nbsp;/&nbsp;<a href='LuceneCoreQuery.dtd.org.html' target='_top'>NO FRAMES</a></p><pre id='dtd_source'><span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> &lt;h3&gt;Background&lt;/h3&gt;</span>
<span class="dtd_comment"> This DTD describes the XML syntax used to perform advanced searches using the core Lucene search engine. The motivation behind the XML query syntax is:</span>
<span class="dtd_comment"> &lt;ol&gt;</span>
<span class="dtd_comment"> &lt;li&gt;To open up Lucene functionality to clients other than Java&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;To offer a form of expressing queries that can easily be</span>
<span class="dtd_comment"> &lt;ul&gt;</span>
<span class="dtd_comment"> &lt;li&gt;Persisted for logging/auditing purposes&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;Changed by editing text query templates (XSLT) without requiring a recompile/redeploy of applications&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;Serialized across networks (without requiring Java bytecode for Query logic deployed on clients)&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;/ul&gt;</span>
<span class="dtd_comment"> &lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;To provide a shorthand way of expressing query logic which echos the logical tree structure of query objects more closely than reading procedural Java query construction code&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;To bridge the growing gap between Lucene query/filtering functionality and the set of functionality accessible throught the standard Lucene QueryParser syntax&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;To provide a simply extensible syntax that does not require complex parser skills such as knowledge of JavaCC syntax&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;/ol&gt;</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;h3&gt;Syntax overview&lt;/h3&gt;</span>
<span class="dtd_comment"> Search syntax consists of two types of elements:</span>
<span class="dtd_comment"> &lt;ul&gt;</span>
<span class="dtd_comment"> &lt;li&gt;&lt;i&gt;Queries&lt;/i&gt;&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt;&lt;i&gt;Filters&lt;/i&gt;&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;/ul&gt;</span>
<span class="dtd_comment"> &lt;h4&gt;Queries&lt;/h4&gt;</span>
<span class="dtd_comment"> The root of any XML search must be a &lt;i&gt;Query&lt;/i&gt; type element used to select content.</span>
<span class="dtd_comment"> Queries typically score matches on documents using a number of different factors in order to provide relevant results first. </span>
<span class="dtd_comment"> One common example of a query tag is the &lt;a href=&quot;#UserQuery&quot;&gt;UserQuery&lt;/a&gt; element which uses the standard </span>
<span class="dtd_comment"> Lucene QueryParser to parse Google-style search syntax provided by end users.</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;h4&gt;Filters&lt;/h4&gt;</span>
<span class="dtd_comment"> Unlike Queries, &lt;i&gt;Filters&lt;/i&gt; are not used to select or score content - they are simply used to filter &lt;i&gt;Query&lt;/i&gt; output (see &lt;a href=&quot;#FilteredQuery&quot;&gt;FilteredQuery&lt;/a&gt; for an example use of query filtering).</span>
<span class="dtd_comment"> Because Filters simply offer a yes/no decision for each document in the index their output can be efficiently cached in memory as a &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/util/BitSet.html&quot;&gt;Bitset&lt;/a&gt; for</span>
<span class="dtd_comment"> subsequent reuse (see &lt;a href=&quot;#CachedFilter&quot;&gt;CachedFilter&lt;/a&gt; tag).</span>
<span class="dtd_comment"> &lt;h4&gt;Nesting elements&lt;/h4&gt;</span>
<span class="dtd_comment"> Many of the the elements can nest other elements to produce queries/filters of an arbitrary depth and complexity. </span>
<span class="dtd_comment"> The &lt;a href=&quot;#BooleanQuery&quot;&gt;BooleanQuery&lt;/a&gt; element is one such example which provides a means for combining other queries (including other BooleanQueries) using Boolean </span>
<span class="dtd_comment"> logic to determine mandatory or optional elements. </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;h3&gt;Advanced topics&lt;/h3&gt; </span>
<span class="dtd_comment"> &lt;h4&gt;Advanced positional testing - span queries&lt;/h4&gt;</span>
<span class="dtd_comment"> The &lt;i&gt;SpanQuery&lt;/i&gt; class of queries allow for complex positional tests which not only look for certain combinations of words but in particular </span>
<span class="dtd_comment"> positions in relation to each other and the documents containing them.</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> CoreParser.java is the Java class that encapsulates this parser behaviour.</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@title</span><span class="dtd_comment"> Core Lucene </span>
<span class="dtd_comment">--&gt;</span>
<span class="dtd_comment">&lt;!-- </span><span class="dtd_dtddoc_tag">@hidden</span><span class="dtd_comment"> Define core types of XML elements --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">coreSpanQueries</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;SpanOr|SpanNear|SpanOrTerms|SpanFirst|SpanNot|SpanTerm|BoostingTermQuery&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">coreQueries</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery|BoostingTermQuery|NumericRangeQuery&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">coreFilters</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;RangeFilter|NumericRangeFilter|CachedFilter&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- </span><span class="dtd_dtddoc_tag">@hidden</span><span class="dtd_comment"> Allow for extensions --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">extendedSpanQueries1</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot; &quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">extendedQueries1</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot; &quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">extendedFilters1</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot; &quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;%coreSpanQueries;%extendedSpanQueries1;&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">queries</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;%coreQueries;|%spanQueries;%extendedQueries1;&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ENTITY</span><span class="dtd_plain"> % </span><span class="dtd_attribute_name">filters</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;%coreFilters;%extendedFilters1;&quot;</span><span class="dtd_plain"> </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> BooleanQuerys implement Boolean logic which controls how multiple Clauses should be interpreted.</span>
<span class="dtd_comment"> Some clauses may represent optional Query criteria while others represent mandatory criteria. </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Find articles about banks, preferably talking about mergers but nothing to do with &quot;sumitomo&quot;&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;BooleanQuery fieldName=&quot;contents&quot;&gt;</span>
<span class="dtd_comment"> &lt;Clause occurs=&quot;should&quot;&gt;</span>
<span class="dtd_comment"> &lt;TermQuery&gt;merger&lt;/TermQuery&gt;</span>
<span class="dtd_comment"> &lt;/Clause&gt;</span>
<span class="dtd_comment"> &lt;Clause occurs=&quot;mustnot&quot;&gt;</span>
<span class="dtd_comment"> &lt;TermQuery&gt;sumitomo&lt;/TermQuery&gt;</span>
<span class="dtd_comment"> &lt;/Clause&gt;</span>
<span class="dtd_comment"> &lt;Clause occurs=&quot;must&quot;&gt;</span>
<span class="dtd_comment"> &lt;TermQuery&gt;bank&lt;/TermQuery&gt;</span>
<span class="dtd_comment"> &lt;/Clause&gt;</span>
<span class="dtd_comment"> &lt;/BooleanQuery&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment">--&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BooleanQuery</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">Clause</span><span class="dtd_plain">)+</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BooleanQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName can optionally be defined here as a default attribute used by all child elements --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BooleanQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The &quot;Coordination factor&quot; rewards documents that contain more of the optional clauses in this list. This flag can be used to turn off this factor. --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BooleanQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">disableCoord</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;false&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The minimum number of optional clauses that should be present in any one document before it is considered to be a match. --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BooleanQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">minimumNumberShouldMatch</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- NOTE: &quot;Clause&quot; tag has 2 modes of use - inside &lt;BooleanQuery&gt; in which case only &quot;query&quot; types can be</span>
<span class="dtd_comment"> child elements - while in a &lt;BooleanFilter&gt; clause only &quot;filter&quot; types can be contained.</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@hidden</span><span class="dtd_comment"> TODO: Change BooleanFilterBuilder and BooleanQueryBuilder to auto-wrap choice of query or filters. This type of</span>
<span class="dtd_comment"> code already exists in CachedFilter so could be reused.</span>
<span class="dtd_comment">--&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Clause</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">queries</span><span class="dtd_plain">;|%</span><span class="dtd_attribute_name">filters</span><span class="dtd_plain">;)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the clause is optional (should), mandatory (must) or unacceptable (mustNot) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Clause</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">occurs</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">should</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">must</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">mustnot</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;should&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Caches any nested query or filter in an LRU (Least recently used) Cache. Cached queries, like filters, are turned into</span>
<span class="dtd_comment"> Bitsets at a cost of 1 bit per document in the index. The memory cost of a cached query/filter is therefore numberOfDocsinIndex/8 bytes.</span>
<span class="dtd_comment"> Queries that are cached as filters obviously retain none of the scoring information associated with results - they retain just</span>
<span class="dtd_comment"> a Boolean yes/no record of which documents matched. </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Search for documents about banks from the last 10 years - caching the commonly-used &quot;last 10 year&quot; filter as a BitSet in </span>
<span class="dtd_comment"> RAM to eliminate the cost of building this filter from disk for every query&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;FilteredQuery&gt;</span>
<span class="dtd_comment"> &lt;Query&gt;</span>
<span class="dtd_comment"> &lt;UserQuery&gt;bank&lt;/UserQuery&gt;</span>
<span class="dtd_comment"> &lt;/Query&gt; </span>
<span class="dtd_comment"> &lt;Filter&gt;</span>
<span class="dtd_comment"> &lt;CachedFilter&gt;</span>
<span class="dtd_comment"> &lt;RangeFilter fieldName=&quot;date&quot; lowerTerm=&quot;19970101&quot; upperTerm=&quot;20070101&quot;/&gt;</span>
<span class="dtd_comment"> &lt;/CachedFilter&gt;</span>
<span class="dtd_comment"> &lt;/Filter&gt; </span>
<span class="dtd_comment"> &lt;/FilteredQuery&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">CachedFilter</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">queries</span><span class="dtd_plain">;|%</span><span class="dtd_attribute_name">filters</span><span class="dtd_plain">;)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment">Passes content directly through to the standard LuceneQuery parser see &quot;Lucene Query Syntax&quot;</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Search for documents about John Smith or John Doe using standard LuceneQuerySyntax&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;UserQuery&gt;&quot;John Smith&quot; OR &quot;John Doe&quot;&lt;/UserQuery&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment">--&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">UserQuery</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">UserQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName can optionally be defined here to change the default field used in the QueryParser --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">UserQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- A query which is used to match all documents. This has a couple of uses: </span>
<span class="dtd_comment"> &lt;ol&gt;</span>
<span class="dtd_comment"> &lt;li&gt; as a Clause in a BooleanQuery who's only other clause</span>
<span class="dtd_comment"> is a &quot;mustNot&quot; match (Lucene requires at least one positive clause) and..&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;li&gt; in a FilteredQuery where a Filter tag is effectively being </span>
<span class="dtd_comment"> used to select content rather than it's usual role of filtering the results of a query.&lt;/li&gt;</span>
<span class="dtd_comment"> &lt;/ol&gt;</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Effectively use a Filter as a query &lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;FilteredQuery&gt;</span>
<span class="dtd_comment"> &lt;Query&gt;</span>
<span class="dtd_comment"> &lt;MatchAllDocsQuery/&gt;</span>
<span class="dtd_comment"> &lt;/Query&gt;</span>
<span class="dtd_comment"> &lt;Filter&gt;</span>
<span class="dtd_comment"> &lt;RangeFilter fieldName=&quot;date&quot; lowerTerm=&quot;19870409&quot; upperTerm=&quot;19870412&quot;/&gt;</span>
<span class="dtd_comment"> &lt;/Filter&gt; </span>
<span class="dtd_comment"> &lt;/FilteredQuery&gt; </span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment">--&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">MatchAllDocsQuery</span><span class="dtd_plain"> </span><span class="dtd_keyword">EMPTY</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- a single term query - no analysis is done of the child text</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Match on a primary key&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;TermQuery fieldName=&quot;primaryKey&quot;&gt;13424&lt;/TermQuery&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment">--&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermQuery</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> A boosted term query - no analysis is done of the child text. Also a span member.</span>
<span class="dtd_comment"> (Text below is copied from the javadocs of BoostingTermQuery)</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> The BoostingTermQuery is very similar to the {@link org.apache.lucene.search.spans.SpanTermQuery} except</span>
<span class="dtd_comment"> that it factors in the value of the payload located at each of the positions where the</span>
<span class="dtd_comment"> {@link org.apache.lucene.index.Term} occurs.</span>
<span class="dtd_comment"> In order to take advantage of this, you must override {@link org.apache.lucene.search.Similarity#scorePayload(String, byte[],int,int)}</span>
<span class="dtd_comment"> which returns 1 by default.</span>
<span class="dtd_comment"> Payload scores are averaged across term occurrences in the document.</span>
<span class="dtd_comment"> @see org.apache.lucene.search.Similarity#scorePayload(String, byte[], int, int)</span>
<span class="dtd_comment">--&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">BoostingTermQuery</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- </span>
<span class="dtd_comment"> The equivalent of a BooleanQuery with multiple optional TermQuery clauses.</span>
<span class="dtd_comment"> Child text is analyzed using a field-specific choice of Analyzer to produce a set of terms that are ORed together in Boolean logic.</span>
<span class="dtd_comment"> Unlike UserQuery element, this does not parse any special characters to control fuzzy/phrase/boolean logic and as such is incapable</span>
<span class="dtd_comment"> of producing a Query parse error given any user input</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Match on text from a database description (which may contain characters that </span>
<span class="dtd_comment"> are illegal characters in the standard Lucene Query syntax used in the UserQuery tag&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;TermsQuery fieldName=&quot;description&quot;&gt;Smith &amp; Sons (Ltd) : incorporated 1982&lt;/TermsQuery&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment">--&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermsQuery</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermsQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermsQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The &quot;Coordination factor&quot; rewards documents that contain more of the terms in this list. This flag can be used to turn off this factor. --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermsQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">disableCoord</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;false&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The minimum number of terms that should be present in any one document before it is considered to be a match. --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">TermsQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">minimumNumberShouldMatch</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- </span>
<span class="dtd_comment"> Runs a Query and filters results to only those query matches that also match the Filter element. </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Find all documents about Lucene that have a status of &quot;published&quot;&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;FilteredQuery&gt;</span>
<span class="dtd_comment"> &lt;Query&gt;</span>
<span class="dtd_comment"> &lt;UserQuery&gt;Lucene&lt;/UserQuery&gt;</span>
<span class="dtd_comment"> &lt;/Query&gt;</span>
<span class="dtd_comment"> &lt;Filter&gt;</span>
<span class="dtd_comment"> &lt;TermsFilter fieldName=&quot;status&quot;&gt;published&lt;/TermsFilter&gt;</span>
<span class="dtd_comment"> &lt;/Filter&gt; </span>
<span class="dtd_comment"> &lt;/FilteredQuery&gt; </span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment">--&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">FilteredQuery</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">Query</span><span class="dtd_plain">,</span><span class="dtd_attribute_name">Filter</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">FilteredQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Used to identify a nested Query element inside another container element. NOT a top-level query tag --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Query</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">queries</span><span class="dtd_plain">;)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The choice of Filter that MUST also be matched --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Filter</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">filters</span><span class="dtd_plain">;)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> Filter used to limit query results to documents matching a range of field values</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Search for documents about banks from the last 10 years&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;FilteredQuery&gt;</span>
<span class="dtd_comment"> &lt;Query&gt;</span>
<span class="dtd_comment"> &lt;UserQuery&gt;bank&lt;/UserQuery&gt;</span>
<span class="dtd_comment"> &lt;/Query&gt; </span>
<span class="dtd_comment"> &lt;Filter&gt;</span>
<span class="dtd_comment"> &lt;RangeFilter fieldName=&quot;date&quot; lowerTerm=&quot;19970101&quot; upperTerm=&quot;20070101&quot;/&gt;</span>
<span class="dtd_comment"> &lt;/Filter&gt; </span>
<span class="dtd_comment"> &lt;/FilteredQuery&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_keyword">EMPTY</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The lower-most term value for this field (must be &lt;= upperTerm) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">lowerTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The upper-most term value for this field (must be &gt;= lowerTerm) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">upperTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the lowerTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeLower</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the upperTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">RangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeUpper</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> A Query that matches numeric values within a specified range.</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Search for documents about people who are aged 20-25&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;NumericRangeQuery fieldName=&quot;age&quot; lowerTerm=&quot;20&quot; upperTerm=&quot;25&quot; /&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_keyword">EMPTY</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The lower-most term value for this field (must be &lt;= upperTerm and a valid native java numeric type) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">lowerTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The upper-most term value for this field (must be &gt;= lowerTerm and a valid native java numeric type) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">upperTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The numeric type of this field --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">type</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">int</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">long</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">float</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">double</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;int&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the lowerTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeLower</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the upperTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeUpper</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Lower step values mean more precisions and so more terms in index (and index gets larger). This value must be an integer --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">precisionStep</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;4&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!--</span>
<span class="dtd_comment"> A Filter that only accepts numeric values within a specified range</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Search for documents about people who are aged 20-25&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;FilteredQuery&gt;</span>
<span class="dtd_comment"> &lt;Query&gt;</span>
<span class="dtd_comment"> &lt;UserQuery&gt;person&lt;/UserQuery&gt;</span>
<span class="dtd_comment"> &lt;/Query&gt; </span>
<span class="dtd_comment"> &lt;Filter&gt;</span>
<span class="dtd_comment"> &lt;NumericRangeFilter fieldName=&quot;age&quot; lowerTerm=&quot;20&quot; upperTerm=&quot;25&quot;/&gt;</span>
<span class="dtd_comment"> &lt;/Filter&gt; </span>
<span class="dtd_comment"> &lt;/FilteredQuery&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_keyword">EMPTY</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#IMPLIED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The lower-most term value for this field (must be &lt;= upperTerm and a valid native java numeric type) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">lowerTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The upper-most term value for this field (must be &gt;= lowerTerm and a valid native java numeric type) --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">upperTerm</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The numeric type of this field --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">type</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">int</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">long</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">float</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">double</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;int&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the lowerTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeLower</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if the upperTerm in the range is part of the allowed set of values --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">includeUpper</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Lower step values mean more precisions and so more terms in index (and index gets larger). This value must be an integer --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">NumericRangeFilter</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">precisionStep</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;4&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- A single term used in a SpanQuery. These clauses are the building blocks for more complex &quot;span&quot; queries which test word proximity</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt;Find documents using terms close to each other about mining and accidents&lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;SpanNear slop=&quot;8&quot; inOrder=&quot;false&quot; fieldName=&quot;text&quot;&gt; </span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;killed&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;died&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;dead&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miner&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;mining&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miners&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;/SpanNear&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanTerm</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanTerm</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- A field-specific analyzer is used here to parse the child text provided in this tag. The SpanTerms produced are ORed in terms of Boolean logic </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt;Use SpanOrTerms as a more convenient/succinct way of expressing multiple choices of SpanTerms. This example looks for reports </span>
<span class="dtd_comment"> using words describing a fatality near to references to miners&lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;SpanNear slop=&quot;8&quot; inOrder=&quot;false&quot; fieldName=&quot;text&quot;&gt; </span>
<span class="dtd_comment"> &lt;SpanOrTerms&gt;killed died death dead deaths&lt;/SpanOrTerms&gt;</span>
<span class="dtd_comment"> &lt;SpanOrTerms&gt;miner mining miners&lt;/SpanOrTerms&gt;</span>
<span class="dtd_comment"> &lt;/SpanNear&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanOrTerms</span><span class="dtd_plain"> (</span><span class="dtd_keyword">#PCDATA</span><span class="dtd_plain">)</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a &quot;fieldName&quot; attribute --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanOrTerms</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">fieldName</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Takes any number of child queries from the Span family </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt;Find documents using terms close to each other about mining and accidents&lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;SpanNear slop=&quot;8&quot; inOrder=&quot;false&quot; fieldName=&quot;text&quot;&gt; </span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;killed&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;died&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;dead&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miner&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;mining&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miners&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;/SpanNear&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanOr</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain">;)* </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Takes any number of child queries from the Span family and tests for proximity</span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@hidden</span><span class="dtd_comment"> TODO SpanNear missing &quot;boost attr (could add to SpanBuilderBase)</span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanNear</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain">;)* </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- defines the maximum distance between Span elements where distance is expressed as word number, not byte offset </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt;Find documents using terms within 8 words of each other talking about mining and accidents&lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;SpanNear slop=&quot;8&quot; inOrder=&quot;false&quot; fieldName=&quot;text&quot;&gt; </span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;killed&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;died&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;dead&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanOr&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miner&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;mining&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;miners&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanOr&gt;</span>
<span class="dtd_comment"> &lt;/SpanNear&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanNear</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">slop</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls if matching terms have to appear in the order listed or can be reversed --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanNear</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">inOrder</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">true</span><span class="dtd_plain"> | </span><span class="dtd_attribute_name">false</span><span class="dtd_plain">) </span><span class="dtd_attribute_value">&quot;true&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Looks for a SpanQuery match occuring near the beginning of a document</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> </span>
<span class="dtd_comment"> &lt;em&gt;Find letters where the first 50 words talk about a resignation:&lt;/em&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> &lt;SpanFirst end=&quot;50&quot;&gt;</span>
<span class="dtd_comment"> &lt;SpanOrTerms fieldName=&quot;text&quot;&gt;resigning resign leave&lt;/SpanOrTerms&gt;</span>
<span class="dtd_comment"> &lt;/SpanFirst&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanFirst</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain">;) </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Controls the end of the region considered in a document's field (expressed in word number, not byte offset) --&gt;</span><span class="dtd_plain"> </span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanFirst</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">end</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_keyword">#REQUIRED</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanFirst</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Finds documents matching a SpanQuery but not if matching another SpanQuery </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt;Find documents talking about social services but not containing the word &quot;public&quot;&lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;SpanNot fieldName=&quot;text&quot;&gt;</span>
<span class="dtd_comment"> &lt;Include&gt;</span>
<span class="dtd_comment"> &lt;SpanNear slop=&quot;2&quot; inOrder=&quot;true&quot;&gt; </span>
<span class="dtd_comment"> &lt;SpanTerm&gt;social&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;services&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/SpanNear&gt; </span>
<span class="dtd_comment"> &lt;/Include&gt;</span>
<span class="dtd_comment"> &lt;Exclude&gt;</span>
<span class="dtd_comment"> &lt;SpanTerm&gt;public&lt;/SpanTerm&gt;</span>
<span class="dtd_comment"> &lt;/Exclude&gt;</span>
<span class="dtd_comment"> &lt;/SpanNot&gt;</span>
<span class="dtd_comment"> % </span>
<span class="dtd_comment"> </span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">SpanNot</span><span class="dtd_plain"> (</span><span class="dtd_attribute_name">Include</span><span class="dtd_plain">,</span><span class="dtd_attribute_name">Exclude</span><span class="dtd_plain">) </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The SpanQuery to find --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Include</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain">;) </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- The SpanQuery to be avoided --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">Exclude</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">spanQueries</span><span class="dtd_plain">;) </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- a utility tag to wrap any filter as a query </span>
<span class="dtd_comment"> </span><span class="dtd_dtddoc_tag">@example</span><span class="dtd_comment"> &lt;em&gt; Find all documents from the last 10 years &lt;/em&gt;</span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> &lt;ConstantScoreQuery&gt;</span>
<span class="dtd_comment"> &lt;RangeFilter fieldName=&quot;date&quot; lowerTerm=&quot;19970101&quot; upperTerm=&quot;20070101&quot;/&gt;</span>
<span class="dtd_comment"> &lt;/ConstantScoreQuery&gt; </span>
<span class="dtd_comment"> %</span>
<span class="dtd_comment"> --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ELEMENT</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">ConstantScoreQuery</span><span class="dtd_plain"> (%</span><span class="dtd_attribute_name">filters</span><span class="dtd_plain">;)* </span><span class="dtd_tag_symbols">&gt;</span>
<span class="dtd_comment">&lt;!-- Optional boost for matches on this query. Values &gt; 1 --&gt;</span>
<span class="dtd_tag_symbols">&lt;!</span><span class="dtd_tag_name">ATTLIST</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">ConstantScoreQuery</span><span class="dtd_plain"> </span><span class="dtd_attribute_name">boost</span><span class="dtd_plain"> </span><span class="dtd_keyword">CDATA</span><span class="dtd_plain"> </span><span class="dtd_attribute_value">&quot;1.0&quot;</span><span class="dtd_tag_symbols">&gt;</span>
</pre>
</body></html>