mirror of https://github.com/apache/lucene.git
720 lines
54 KiB
HTML
720 lines
54 KiB
HTML
<!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> / <a href='LuceneCoreQuery.dtd.html' target='_top'>NO FRAMES</a></p><h1>Core Lucene</h1>
|
|
<p><h3>Background</h3>
|
|
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:
|
|
<ol>
|
|
<li>To open up Lucene functionality to clients other than Java</li>
|
|
<li>To offer a form of expressing queries that can easily be
|
|
<ul>
|
|
<li>Persisted for logging/auditing purposes</li>
|
|
<li>Changed by editing text query templates (XSLT) without requiring a recompile/redeploy of applications</li>
|
|
<li>Serialized across networks (without requiring Java bytecode for Query logic deployed on clients)</li>
|
|
</ul>
|
|
</li>
|
|
<li>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</li>
|
|
<li>To bridge the growing gap between Lucene query/filtering functionality and the set of functionality accessible throught the standard Lucene QueryParser syntax</li>
|
|
<li>To provide a simply extensible syntax that does not require complex parser skills such as knowledge of JavaCC syntax</li>
|
|
</ol></p><p><h3>Syntax overview</h3>
|
|
Search syntax consists of two types of elements:
|
|
<ul>
|
|
<li><i>Queries</i></li>
|
|
<li><i>Filters</i></li>
|
|
</ul></p><p><h4>Queries</h4>
|
|
The root of any XML search must be a <i>Query</i> type element used to select content.
|
|
Queries typically score matches on documents using a number of different factors in order to provide relevant results first.
|
|
One common example of a query tag is the <a href="#UserQuery">UserQuery</a> element which uses the standard
|
|
Lucene QueryParser to parse Google-style search syntax provided by end users.</p><p><h4>Filters</h4>
|
|
Unlike Queries, <i>Filters</i> are not used to select or score content - they are simply used to filter <i>Query</i> output (see <a href="#FilteredQuery">FilteredQuery</a> for an example use of query filtering).
|
|
Because Filters simply offer a yes/no decision for each document in the index their output can be efficiently cached in memory as a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/BitSet.html">Bitset</a> for
|
|
subsequent reuse (see <a href="#CachedFilter">CachedFilter</a> tag).</p><p><h4>Nesting elements</h4>
|
|
Many of the the elements can nest other elements to produce queries/filters of an arbitrary depth and complexity.
|
|
The <a href="#BooleanQuery">BooleanQuery</a> element is one such example which provides a means for combining other queries (including other BooleanQueries) using Boolean
|
|
logic to determine mandatory or optional elements.</p><p><h3>Advanced topics</h3>
|
|
<h4>Advanced positional testing - span queries</h4>
|
|
The <i>SpanQuery</i> class of queries allow for complex positional tests which not only look for certain combinations of words but in particular
|
|
positions in relation to each other and the documents containing them.</p><p>CoreParser.java is the Java class that encapsulates this parser behaviour.</p><br />
|
|
<a name='BooleanQuery'></a>
|
|
<br /><table class='elementTitle' summary="BooleanQuery"><tr><td class='leftElementTitle'>
|
|
<BooleanQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>BooleanQuerys implement Boolean logic which controls how multiple Clauses should be interpreted.
|
|
Some clauses may represent optional Query criteria while others represent mandatory criteria.</p><p><span class='inTextTitle'>Example:</span> <em>Find articles about banks, preferably talking about mergers but nothing to do with "sumitomo"</em>
|
|
</p><pre>
|
|
<BooleanQuery fieldName="contents">
|
|
<Clause occurs="should">
|
|
<TermQuery>merger</TermQuery>
|
|
</Clause>
|
|
<Clause occurs="mustnot">
|
|
<TermQuery>sumitomo</TermQuery>
|
|
</Clause>
|
|
<Clause occurs="must">
|
|
<TermQuery>bank</TermQuery>
|
|
</Clause>
|
|
</BooleanQuery>
|
|
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<BooleanQuery>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><BooleanQuery>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#Clause'>Clause</a></td><td>At least one</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<BooleanQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><BooleanQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#BooleanQuery_boost'>boost</a></td><td></td><td>1.0</td></tr><tr><td><a href='#BooleanQuery_disableCoord'>disableCoord</a></td><td>true, false</td><td>false</td></tr><tr><td><a href='#BooleanQuery_fieldName'>fieldName</a></td><td></td><td></td></tr><tr><td><a href='#BooleanQuery_minimumNumberShouldMatch'>minimumNumberShouldMatch</a></td><td></td><td>0</td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#Clause'>Clause</a>)+</p><a name='BooleanQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#BooleanQuery'>BooleanQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='BooleanQuery_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#BooleanQuery'>BooleanQuery</a>
|
|
</td></tr></table>
|
|
<p>fieldName can optionally be defined here as a default attribute used by all child elements</p><a name='BooleanQuery_disableCoord'></a>
|
|
<br /><table class='attributeTitle' summary="disableCoord"><tr><td class='leftAttributeTitle'>
|
|
@disableCoord</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#BooleanQuery'>BooleanQuery</a>
|
|
</td></tr></table>
|
|
<p>The "Coordination factor" rewards documents that contain more of the optional clauses in this list. This flag can be used to turn off this factor.</p><p><span class='inTextTitle'>Possible values</span>: true, false - <span class='inTextTitle'>Default value</span>: false</p><a name='BooleanQuery_minimumNumberShouldMatch'></a>
|
|
<br /><table class='attributeTitle' summary="minimumNumberShouldMatch"><tr><td class='leftAttributeTitle'>
|
|
@minimumNumberShouldMatch</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#BooleanQuery'>BooleanQuery</a>
|
|
</td></tr></table>
|
|
<p>The minimum number of optional clauses that should be present in any one document before it is considered to be a match.</p><p><span class='inTextTitle'>Default value</span>: 0</p><a name='Clause'></a>
|
|
<br /><table class='elementTitle' summary="Clause"><tr><td class='leftElementTitle'>
|
|
<Clause></td><td class='rightElementTitle'>
|
|
Child of <a href='#BooleanQuery'>BooleanQuery</a>
|
|
</td></tr></table>
|
|
<p>NOTE: "Clause" tag has 2 modes of use - inside <BooleanQuery> in which case only "query" types can be
|
|
child elements - while in a <BooleanFilter> clause only "filter" types can be contained.</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<Clause>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><Clause>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#BooleanQuery'>BooleanQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#CachedFilter'>CachedFilter</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#ConstantScoreQuery'>ConstantScoreQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#FilteredQuery'>FilteredQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#RangeFilter'>RangeFilter</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermQuery'>TermQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermsQuery'>TermsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#UserQuery'>UserQuery</a></td><td>One or none</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<Clause>'s attributes"><tr>
|
|
<th class='title' colspan='3'><Clause>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#Clause_occurs'>occurs</a></td><td>should, must, mustnot</td><td>should</td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#BooleanQuery'>BooleanQuery</a> | <a href='#UserQuery'>UserQuery</a> | <a href='#FilteredQuery'>FilteredQuery</a> | <a href='#TermQuery'>TermQuery</a> | <a href='#TermsQuery'>TermsQuery</a> | <a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a> | <a href='#ConstantScoreQuery'>ConstantScoreQuery</a> | <a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a> | <a href='#RangeFilter'>RangeFilter</a> | <a href='#CachedFilter'>CachedFilter</a>)</p><a name='Clause_occurs'></a>
|
|
<br /><table class='attributeTitle' summary="occurs"><tr><td class='leftAttributeTitle'>
|
|
@occurs</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#Clause'>Clause</a>
|
|
</td></tr></table>
|
|
<p>Controls if the clause is optional (should), mandatory (must) or unacceptable (mustNot)</p><p><span class='inTextTitle'>Possible values</span>: should, must, mustnot - <span class='inTextTitle'>Default value</span>: should</p><a name='CachedFilter'></a>
|
|
<br /><table class='elementTitle' summary="CachedFilter"><tr><td class='leftElementTitle'>
|
|
<CachedFilter></td><td class='rightElementTitle'>
|
|
Child of <a href='#ConstantScoreQuery'>ConstantScoreQuery</a>, <a href='#Clause'>Clause</a>, <a href='#Filter'>Filter</a>
|
|
</td></tr></table>
|
|
<p>Caches any nested query or filter in an LRU (Least recently used) Cache. Cached queries, like filters, are turned into
|
|
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.
|
|
Queries that are cached as filters obviously retain none of the scoring information associated with results - they retain just
|
|
a Boolean yes/no record of which documents matched.</p><p><span class='inTextTitle'>Example:</span> <em>Search for documents about banks from the last 10 years - caching the commonly-used "last 10 year" filter as a BitSet in
|
|
RAM to eliminate the cost of building this filter from disk for every query</em>
|
|
</p><pre>
|
|
<FilteredQuery>
|
|
<Query>
|
|
<UserQuery>bank</UserQuery>
|
|
</Query>
|
|
<Filter>
|
|
<CachedFilter>
|
|
<RangeFilter fieldName="date" lowerTerm="19970101" upperTerm="20070101"/>
|
|
</CachedFilter>
|
|
</Filter>
|
|
</FilteredQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<CachedFilter>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><CachedFilter>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#BooleanQuery'>BooleanQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#CachedFilter'>CachedFilter</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#ConstantScoreQuery'>ConstantScoreQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#FilteredQuery'>FilteredQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#RangeFilter'>RangeFilter</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermQuery'>TermQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermsQuery'>TermsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#UserQuery'>UserQuery</a></td><td>One or none</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#BooleanQuery'>BooleanQuery</a> | <a href='#UserQuery'>UserQuery</a> | <a href='#FilteredQuery'>FilteredQuery</a> | <a href='#TermQuery'>TermQuery</a> | <a href='#TermsQuery'>TermsQuery</a> | <a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a> | <a href='#ConstantScoreQuery'>ConstantScoreQuery</a> | <a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a> | <a href='#RangeFilter'>RangeFilter</a> | <a href='#CachedFilter'>CachedFilter</a>)</p><a name='UserQuery'></a>
|
|
<br /><table class='elementTitle' summary="UserQuery"><tr><td class='leftElementTitle'>
|
|
<UserQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Passes content directly through to the standard LuceneQuery parser see "Lucene Query Syntax"</p><p><span class='inTextTitle'>Example:</span> <em>Search for documents about John Smith or John Doe using standard LuceneQuerySyntax</em>
|
|
</p><pre>
|
|
<UserQuery>"John Smith" OR "John Doe"</UserQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<UserQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><UserQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#UserQuery_boost'>boost</a></td><td></td><td>1.0</td></tr><tr><td><a href='#UserQuery_fieldName'>fieldName</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<a name='UserQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#UserQuery'>UserQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='UserQuery_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#UserQuery'>UserQuery</a>
|
|
</td></tr></table>
|
|
<p>fieldName can optionally be defined here to change the default field used in the QueryParser</p><a name='MatchAllDocsQuery'></a>
|
|
<br /><table class='elementTitle' summary="MatchAllDocsQuery"><tr><td class='leftElementTitle'>
|
|
<MatchAllDocsQuery/></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>A query which is used to match all documents. This has a couple of uses:
|
|
<ol>
|
|
<li> as a Clause in a BooleanQuery who's only other clause
|
|
is a "mustNot" match (Lucene requires at least one positive clause) and..</li>
|
|
<li> in a FilteredQuery where a Filter tag is effectively being
|
|
used to select content rather than it's usual role of filtering the results of a query.</li>
|
|
</ol></p><p><span class='inTextTitle'>Example:</span> <em>Effectively use a Filter as a query </em>
|
|
</p><pre>
|
|
<FilteredQuery>
|
|
<Query>
|
|
<MatchAllDocsQuery/>
|
|
</Query>
|
|
<Filter>
|
|
<RangeFilter fieldName="date" lowerTerm="19870409" upperTerm="19870412"/>
|
|
</Filter>
|
|
</FilteredQuery>
|
|
</pre><p></p><p class='emptyTagNote'>This element is always empty.</p><a name='TermQuery'></a>
|
|
<br /><table class='elementTitle' summary="TermQuery"><tr><td class='leftElementTitle'>
|
|
<TermQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>a single term query - no analysis is done of the child text</p><p><span class='inTextTitle'>Example:</span> <em>Match on a primary key</em>
|
|
</p><pre>
|
|
<TermQuery fieldName="primaryKey">13424</TermQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<TermQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><TermQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#TermQuery_boost'>boost</a></td><td></td><td>1.0</td></tr><tr><td><a href='#TermQuery_fieldName'>fieldName</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<a name='TermQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermQuery'>TermQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='TermQuery_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermQuery'>TermQuery</a>
|
|
</td></tr></table>
|
|
<p>fieldName must be defined here or is taken from the most immediate parent XML element that defines a "fieldName" attribute</p><a name='TermsQuery'></a>
|
|
<br /><table class='elementTitle' summary="TermsQuery"><tr><td class='leftElementTitle'>
|
|
<TermsQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>The equivalent of a BooleanQuery with multiple optional TermQuery clauses.
|
|
Child text is analyzed using a field-specific choice of Analyzer to produce a set of terms that are ORed together in Boolean logic.
|
|
Unlike UserQuery element, this does not parse any special characters to control fuzzy/phrase/boolean logic and as such is incapable
|
|
of producing a Query parse error given any user input</p><p><span class='inTextTitle'>Example:</span> <em>Match on text from a database description (which may contain characters that
|
|
are illegal characters in the standard Lucene Query syntax used in the UserQuery tag</em>
|
|
</p><pre>
|
|
<TermsQuery fieldName="description">Smith & Sons (Ltd) : incorporated 1982</TermsQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<TermsQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><TermsQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#TermsQuery_boost'>boost</a></td><td></td><td>1.0</td></tr><tr><td><a href='#TermsQuery_disableCoord'>disableCoord</a></td><td>true, false</td><td>false</td></tr><tr><td><a href='#TermsQuery_fieldName'>fieldName</a></td><td></td><td></td></tr><tr><td><a href='#TermsQuery_minimumNumberShouldMatch'>minimumNumberShouldMatch</a></td><td></td><td>0</td></tr></table></td></tr></table></blockquote>
|
|
<a name='TermsQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermsQuery'>TermsQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='TermsQuery_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermsQuery'>TermsQuery</a>
|
|
</td></tr></table>
|
|
<p>fieldName must be defined here or is taken from the most immediate parent XML element that defines a "fieldName" attribute</p><a name='TermsQuery_disableCoord'></a>
|
|
<br /><table class='attributeTitle' summary="disableCoord"><tr><td class='leftAttributeTitle'>
|
|
@disableCoord</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermsQuery'>TermsQuery</a>
|
|
</td></tr></table>
|
|
<p>The "Coordination factor" rewards documents that contain more of the terms in this list. This flag can be used to turn off this factor.</p><p><span class='inTextTitle'>Possible values</span>: true, false - <span class='inTextTitle'>Default value</span>: false</p><a name='TermsQuery_minimumNumberShouldMatch'></a>
|
|
<br /><table class='attributeTitle' summary="minimumNumberShouldMatch"><tr><td class='leftAttributeTitle'>
|
|
@minimumNumberShouldMatch</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#TermsQuery'>TermsQuery</a>
|
|
</td></tr></table>
|
|
<p>The minimum number of terms that should be present in any one document before it is considered to be a match.</p><p><span class='inTextTitle'>Default value</span>: 0</p><a name='FilteredQuery'></a>
|
|
<br /><table class='elementTitle' summary="FilteredQuery"><tr><td class='leftElementTitle'>
|
|
<FilteredQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Runs a Query and filters results to only those query matches that also match the Filter element.</p><p><span class='inTextTitle'>Example:</span> <em>Find all documents about Lucene that have a status of "published"</em>
|
|
</p><pre>
|
|
<FilteredQuery>
|
|
<Query>
|
|
<UserQuery>Lucene</UserQuery>
|
|
</Query>
|
|
<Filter>
|
|
<TermsFilter fieldName="status">published</TermsFilter>
|
|
</Filter>
|
|
</FilteredQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<FilteredQuery>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><FilteredQuery>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#Filter'>Filter</a></td><td>Only one</td></tr>
|
|
<tr><td><a href='#Query'>Query</a></td><td>Only one</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<FilteredQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><FilteredQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#FilteredQuery_boost'>boost</a></td><td></td><td>1.0</td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#Query'>Query</a>, <a href='#Filter'>Filter</a>)</p><a name='FilteredQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#FilteredQuery'>FilteredQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='Query'></a>
|
|
<br /><table class='elementTitle' summary="Query"><tr><td class='leftElementTitle'>
|
|
<Query></td><td class='rightElementTitle'>
|
|
Child of <a href='#FilteredQuery'>FilteredQuery</a>
|
|
</td></tr></table>
|
|
<p>Used to identify a nested Query element inside another container element. NOT a top-level query tag</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<Query>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><Query>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#BooleanQuery'>BooleanQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#ConstantScoreQuery'>ConstantScoreQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#FilteredQuery'>FilteredQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermQuery'>TermQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#TermsQuery'>TermsQuery</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#UserQuery'>UserQuery</a></td><td>One or none</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#BooleanQuery'>BooleanQuery</a> | <a href='#UserQuery'>UserQuery</a> | <a href='#FilteredQuery'>FilteredQuery</a> | <a href='#TermQuery'>TermQuery</a> | <a href='#TermsQuery'>TermsQuery</a> | <a href='#MatchAllDocsQuery'>MatchAllDocsQuery</a> | <a href='#ConstantScoreQuery'>ConstantScoreQuery</a> | <a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)</p><a name='Filter'></a>
|
|
<br /><table class='elementTitle' summary="Filter"><tr><td class='leftElementTitle'>
|
|
<Filter></td><td class='rightElementTitle'>
|
|
Child of <a href='#FilteredQuery'>FilteredQuery</a>
|
|
</td></tr></table>
|
|
<p>The choice of Filter that MUST also be matched</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<Filter>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><Filter>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#CachedFilter'>CachedFilter</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#RangeFilter'>RangeFilter</a></td><td>One or none</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#RangeFilter'>RangeFilter</a> | <a href='#CachedFilter'>CachedFilter</a>)</p><a name='RangeFilter'></a>
|
|
<br /><table class='elementTitle' summary="RangeFilter"><tr><td class='leftElementTitle'>
|
|
<RangeFilter/></td><td class='rightElementTitle'>
|
|
Child of <a href='#ConstantScoreQuery'>ConstantScoreQuery</a>, <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Filter'>Filter</a>
|
|
</td></tr></table>
|
|
<p>Filter used to limit query results to documents matching a range of field values</p><p><span class='inTextTitle'>Example:</span> <em>Search for documents about banks from the last 10 years</em>
|
|
</p><pre>
|
|
<FilteredQuery>
|
|
<Query>
|
|
<UserQuery>bank</UserQuery>
|
|
</Query>
|
|
<Filter>
|
|
<RangeFilter fieldName="date" lowerTerm="19970101" upperTerm="20070101"/>
|
|
</Filter>
|
|
</FilteredQuery>
|
|
</pre><p></p><blockquote>
|
|
<table summary="<RangeFilter>'s attributes"><tr>
|
|
<th class='title' colspan='3'><RangeFilter>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#RangeFilter_fieldName'>fieldName</a></td><td></td><td></td></tr><tr><td><a href='#RangeFilter_includeLower'>includeLower</a></td><td>true, false</td><td>true</td></tr><tr><td><a href='#RangeFilter_includeUpper'>includeUpper</a></td><td>true, false</td><td>true</td></tr><tr><td><a href='#RangeFilter_lowerTerm'>lowerTerm</a></td><td></td><td></td></tr><tr><td><a href='#RangeFilter_upperTerm'>upperTerm</a></td><td></td><td></td></tr></table></blockquote>
|
|
<p class='emptyTagNote'>This element is always empty.</p><a name='RangeFilter_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#RangeFilter'>RangeFilter</a>
|
|
</td></tr></table>
|
|
<p>fieldName must be defined here or is taken from the most immediate parent XML element that defines a "fieldName" attribute</p><a name='RangeFilter_lowerTerm'></a>
|
|
<br /><table class='attributeTitle' summary="lowerTerm"><tr><td class='leftAttributeTitle'>
|
|
@lowerTerm</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#RangeFilter'>RangeFilter</a>
|
|
</td></tr></table>
|
|
<p>The lower-most term value for this field (must be <= upperTerm)</p><p><span class='inTextTitle'>Required</span></p><a name='RangeFilter_upperTerm'></a>
|
|
<br /><table class='attributeTitle' summary="upperTerm"><tr><td class='leftAttributeTitle'>
|
|
@upperTerm</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#RangeFilter'>RangeFilter</a>
|
|
</td></tr></table>
|
|
<p>The upper-most term value for this field (must be >= lowerTerm)</p><p><span class='inTextTitle'>Required</span></p><a name='RangeFilter_includeLower'></a>
|
|
<br /><table class='attributeTitle' summary="includeLower"><tr><td class='leftAttributeTitle'>
|
|
@includeLower</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#RangeFilter'>RangeFilter</a>
|
|
</td></tr></table>
|
|
<p>Controls if the lowerTerm in the range is part of the allowed set of values</p><p><span class='inTextTitle'>Possible values</span>: true, false - <span class='inTextTitle'>Default value</span>: true</p><a name='RangeFilter_includeUpper'></a>
|
|
<br /><table class='attributeTitle' summary="includeUpper"><tr><td class='leftAttributeTitle'>
|
|
@includeUpper</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#RangeFilter'>RangeFilter</a>
|
|
</td></tr></table>
|
|
<p>Controls if the upperTerm in the range is part of the allowed set of values</p><p><span class='inTextTitle'>Possible values</span>: true, false - <span class='inTextTitle'>Default value</span>: true</p><a name='SpanTerm'></a>
|
|
<br /><table class='elementTitle' summary="SpanTerm"><tr><td class='leftElementTitle'>
|
|
<SpanTerm></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanOr'>SpanOr</a>, <a href='#SpanFirst'>SpanFirst</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#SpanNear'>SpanNear</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>A single term used in a SpanQuery. These clauses are the building blocks for more complex "span" queries which test word proximity</p><p><span class='inTextTitle'>Example:</span> <em>Find documents using terms close to each other about mining and accidents</em>
|
|
</p><pre>
|
|
<SpanNear slop="8" inOrder="false" fieldName="text">
|
|
<SpanOr>
|
|
<SpanTerm>killed</SpanTerm>
|
|
<SpanTerm>died</SpanTerm>
|
|
<SpanTerm>dead</SpanTerm>
|
|
</SpanOr>
|
|
<SpanOr>
|
|
<SpanTerm>miner</SpanTerm>
|
|
<SpanTerm>mining</SpanTerm>
|
|
<SpanTerm>miners</SpanTerm>
|
|
</SpanOr>
|
|
</SpanNear>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanTerm>'s attributes"><tr>
|
|
<th class='title' colspan='3'><SpanTerm>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#SpanTerm_fieldName'>fieldName</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<a name='SpanTerm_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanTerm'>SpanTerm</a>
|
|
</td></tr></table>
|
|
<p>fieldName must be defined here or is taken from the most immediate parent XML element that defines a "fieldName" attribute</p><p><span class='inTextTitle'>Required</span></p><a name='SpanOrTerms'></a>
|
|
<br /><table class='elementTitle' summary="SpanOrTerms"><tr><td class='leftElementTitle'>
|
|
<SpanOrTerms></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanOr'>SpanOr</a>, <a href='#SpanFirst'>SpanFirst</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#SpanNear'>SpanNear</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>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</p><p><span class='inTextTitle'>Example:</span> <em>Use SpanOrTerms as a more convenient/succinct way of expressing multiple choices of SpanTerms. This example looks for reports
|
|
using words describing a fatality near to references to miners</em>
|
|
</p><pre>
|
|
<SpanNear slop="8" inOrder="false" fieldName="text">
|
|
<SpanOrTerms>killed died death dead deaths</SpanOrTerms>
|
|
<SpanOrTerms>miner mining miners</SpanOrTerms>
|
|
</SpanNear>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanOrTerms>'s attributes"><tr>
|
|
<th class='title' colspan='3'><SpanOrTerms>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#SpanOrTerms_fieldName'>fieldName</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<a name='SpanOrTerms_fieldName'></a>
|
|
<br /><table class='attributeTitle' summary="fieldName"><tr><td class='leftAttributeTitle'>
|
|
@fieldName</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanOrTerms'>SpanOrTerms</a>
|
|
</td></tr></table>
|
|
<p>fieldName must be defined here or is taken from the most immediate parent XML element that defines a "fieldName" attribute</p><p><span class='inTextTitle'>Required</span></p><a name='SpanOr'></a>
|
|
<br /><table class='elementTitle' summary="SpanOr"><tr><td class='leftElementTitle'>
|
|
<SpanOr></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanFirst'>SpanFirst</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#SpanNear'>SpanNear</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Takes any number of child queries from the Span family</p><p><span class='inTextTitle'>Example:</span> <em>Find documents using terms close to each other about mining and accidents</em>
|
|
</p><pre>
|
|
<SpanNear slop="8" inOrder="false" fieldName="text">
|
|
<SpanOr>
|
|
<SpanTerm>killed</SpanTerm>
|
|
<SpanTerm>died</SpanTerm>
|
|
<SpanTerm>dead</SpanTerm>
|
|
</SpanOr>
|
|
<SpanOr>
|
|
<SpanTerm>miner</SpanTerm>
|
|
<SpanTerm>mining</SpanTerm>
|
|
<SpanTerm>miners</SpanTerm>
|
|
</SpanOr>
|
|
</SpanNear>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanOr>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><SpanOr>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>Any number</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)*</p><a name='SpanNear'></a>
|
|
<br /><table class='elementTitle' summary="SpanNear"><tr><td class='leftElementTitle'>
|
|
<SpanNear></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanOr'>SpanOr</a>, <a href='#SpanFirst'>SpanFirst</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Takes any number of child queries from the Span family and tests for proximity</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanNear>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><SpanNear>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>Any number</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<SpanNear>'s attributes"><tr>
|
|
<th class='title' colspan='3'><SpanNear>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#SpanNear_inOrder'>inOrder</a></td><td>true, false</td><td>true</td></tr><tr><td><a href='#SpanNear_slop'>slop</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)*</p><a name='SpanNear_slop'></a>
|
|
<br /><table class='attributeTitle' summary="slop"><tr><td class='leftAttributeTitle'>
|
|
@slop</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanNear'>SpanNear</a>
|
|
</td></tr></table>
|
|
<p>defines the maximum distance between Span elements where distance is expressed as word number, not byte offset</p><p><span class='inTextTitle'>Example:</span> <em>Find documents using terms within 8 words of each other talking about mining and accidents</em>
|
|
</p><pre>
|
|
<SpanNear slop="8" inOrder="false" fieldName="text">
|
|
<SpanOr>
|
|
<SpanTerm>killed</SpanTerm>
|
|
<SpanTerm>died</SpanTerm>
|
|
<SpanTerm>dead</SpanTerm>
|
|
</SpanOr>
|
|
<SpanOr>
|
|
<SpanTerm>miner</SpanTerm>
|
|
<SpanTerm>mining</SpanTerm>
|
|
<SpanTerm>miners</SpanTerm>
|
|
</SpanOr>
|
|
</SpanNear>
|
|
</pre><p></p><p><span class='inTextTitle'>Required</span></p><a name='SpanNear_inOrder'></a>
|
|
<br /><table class='attributeTitle' summary="inOrder"><tr><td class='leftAttributeTitle'>
|
|
@inOrder</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanNear'>SpanNear</a>
|
|
</td></tr></table>
|
|
<p>Controls if matching terms have to appear in the order listed or can be reversed</p><p><span class='inTextTitle'>Possible values</span>: true, false - <span class='inTextTitle'>Default value</span>: true</p><a name='SpanFirst'></a>
|
|
<br /><table class='elementTitle' summary="SpanFirst"><tr><td class='leftElementTitle'>
|
|
<SpanFirst></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanOr'>SpanOr</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#SpanNear'>SpanNear</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Looks for a SpanQuery match occuring near the beginning of a document</p><p><span class='inTextTitle'>Example:</span> <em>Find letters where the first 50 words talk about a resignation:</em>
|
|
</p><pre>
|
|
<SpanFirst end="50">
|
|
<SpanOrTerms fieldName="text">resigning resign leave</SpanOrTerms>
|
|
</SpanFirst>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanFirst>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><SpanFirst>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<SpanFirst>'s attributes"><tr>
|
|
<th class='title' colspan='3'><SpanFirst>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#SpanFirst_boost'>boost</a></td><td></td><td>1.0</td></tr><tr><td><a href='#SpanFirst_end'>end</a></td><td></td><td></td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)</p><a name='SpanFirst_end'></a>
|
|
<br /><table class='attributeTitle' summary="end"><tr><td class='leftAttributeTitle'>
|
|
@end</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanFirst'>SpanFirst</a>
|
|
</td></tr></table>
|
|
<p>Controls the end of the region considered in a document's field (expressed in word number, not byte offset)</p><p><span class='inTextTitle'>Required</span></p><a name='SpanFirst_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#SpanFirst'>SpanFirst</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p><a name='SpanNot'></a>
|
|
<br /><table class='elementTitle' summary="SpanNot"><tr><td class='leftElementTitle'>
|
|
<SpanNot></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanOr'>SpanOr</a>, <a href='#SpanFirst'>SpanFirst</a>, <a href='#Exclude'>Exclude</a>, <a href='#Clause'>Clause</a>, <a href='#Include'>Include</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#SpanNear'>SpanNear</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>Finds documents matching a SpanQuery but not if matching another SpanQuery</p><p><span class='inTextTitle'>Example:</span> <em>Find documents talking about social services but not containing the word "public"</em>
|
|
</p><pre>
|
|
<SpanNot fieldName="text">
|
|
<Include>
|
|
<SpanNear slop="2" inOrder="true">
|
|
<SpanTerm>social</SpanTerm>
|
|
<SpanTerm>services</SpanTerm>
|
|
</SpanNear>
|
|
</Include>
|
|
<Exclude>
|
|
<SpanTerm>public</SpanTerm>
|
|
</Exclude>
|
|
</SpanNot>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<SpanNot>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><SpanNot>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#Exclude'>Exclude</a></td><td>Only one</td></tr>
|
|
<tr><td><a href='#Include'>Include</a></td><td>Only one</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#Include'>Include</a>, <a href='#Exclude'>Exclude</a>)</p><a name='Include'></a>
|
|
<br /><table class='elementTitle' summary="Include"><tr><td class='leftElementTitle'>
|
|
<Include></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanNot'>SpanNot</a>
|
|
</td></tr></table>
|
|
<p>The SpanQuery to find</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<Include>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><Include>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)</p><a name='Exclude'></a>
|
|
<br /><table class='elementTitle' summary="Exclude"><tr><td class='leftElementTitle'>
|
|
<Exclude></td><td class='rightElementTitle'>
|
|
Child of <a href='#SpanNot'>SpanNot</a>
|
|
</td></tr></table>
|
|
<p>The SpanQuery to be avoided</p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<Exclude>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><Exclude>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#SpanFirst'>SpanFirst</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNear'>SpanNear</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanNot'>SpanNot</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOr'>SpanOr</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanOrTerms'>SpanOrTerms</a></td><td>One or none</td></tr>
|
|
<tr><td><a href='#SpanTerm'>SpanTerm</a></td><td>One or none</td></tr>
|
|
</tbody></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#SpanOr'>SpanOr</a> | <a href='#SpanNear'>SpanNear</a> | <a href='#SpanOrTerms'>SpanOrTerms</a> | <a href='#SpanFirst'>SpanFirst</a> | <a href='#SpanNot'>SpanNot</a> | <a href='#SpanTerm'>SpanTerm</a>)</p><a name='ConstantScoreQuery'></a>
|
|
<br /><table class='elementTitle' summary="ConstantScoreQuery"><tr><td class='leftElementTitle'>
|
|
<ConstantScoreQuery></td><td class='rightElementTitle'>
|
|
Child of <a href='#Clause'>Clause</a>, <a href='#CachedFilter'>CachedFilter</a>, <a href='#Query'>Query</a>
|
|
</td></tr></table>
|
|
<p>a utility tag to wrap any filter as a query</p><p><span class='inTextTitle'>Example:</span> <em> Find all documents from the last 10 years </em>
|
|
</p><pre>
|
|
<ConstantScoreQuery>
|
|
<RangeFilter fieldName="date" lowerTerm="19970101" upperTerm="20070101"/>
|
|
</ConstantScoreQuery>
|
|
</pre><p></p><blockquote><table summary='element info'><tr>
|
|
<td class='construct'><table summary="<ConstantScoreQuery>'s children">
|
|
<thead>
|
|
<tr><th class='title' colspan='2'><ConstantScoreQuery>'s children</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
<tr><th class='subtitle'>Name</th><th class='subtitle'>Cardinality</th></tr>
|
|
<tr><th colspan='2' height='1' class='ruler'></th></tr>
|
|
</thead>
|
|
<tbody><tr><td><a href='#CachedFilter'>CachedFilter</a></td><td>Any number</td></tr>
|
|
<tr><td><a href='#RangeFilter'>RangeFilter</a></td><td>Any number</td></tr>
|
|
</tbody></table></td><td class='construct'><table summary="<ConstantScoreQuery>'s attributes"><tr>
|
|
<th class='title' colspan='3'><ConstantScoreQuery>'s attributes</th>
|
|
</tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr>
|
|
<th class='subtitle'>Name</th><th class='subtitle'>Values</th><th class='subtitle'>Default</th></tr>
|
|
<tr><th colspan='3' height='1' class='ruler'></th></tr>
|
|
<tr><td><a href='#ConstantScoreQuery_boost'>boost</a></td><td></td><td>1.0</td></tr></table></td></tr></table></blockquote>
|
|
<span class='inTextTitle'>Element's model:</span><p class='model'>(<a href='#RangeFilter'>RangeFilter</a> | <a href='#CachedFilter'>CachedFilter</a>)*</p><a name='ConstantScoreQuery_boost'></a>
|
|
<br /><table class='attributeTitle' summary="boost"><tr><td class='leftAttributeTitle'>
|
|
@boost</td><td class='rightAttributeTitle'>
|
|
Attribute of <a href='#ConstantScoreQuery'>ConstantScoreQuery</a>
|
|
</td></tr></table>
|
|
<p>Optional boost for matches on this query. Values > 1</p><p><span class='inTextTitle'>Default value</span>: 1.0</p></body></html>
|