2007-10-09 17:45:27 -04:00
<!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.org.html' target = '_top' > NO FRAMES< / a > < / p > < pre id = 'dtd_source' > < span class = "dtd_comment" > < !--< / span >
< span class = "dtd_comment" > < h3> Background< /h3> < / 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" > < ol> < / span >
< span class = "dtd_comment" > < li> To open up Lucene functionality to clients other than Java< /li> < / span >
< span class = "dtd_comment" > < li> To offer a form of expressing queries that can easily be< / span >
< span class = "dtd_comment" > < ul> < / span >
< span class = "dtd_comment" > < li> Persisted for logging/auditing purposes< /li> < / span >
< span class = "dtd_comment" > < li> Changed by editing text query templates (XSLT) without requiring a recompile/redeploy of applications< /li> < / span >
< span class = "dtd_comment" > < li> Serialized across networks (without requiring Java bytecode for Query logic deployed on clients)< /li> < / span >
< span class = "dtd_comment" > < /ul> < / span >
< span class = "dtd_comment" > < /li> < / span >
< span class = "dtd_comment" > < 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> < / span >
< span class = "dtd_comment" > < li> To bridge the growing gap between Lucene query/filtering functionality and the set of functionality accessible throught the standard Lucene QueryParser syntax< /li> < / span >
< span class = "dtd_comment" > < li> To provide a simply extensible syntax that does not require complex parser skills such as knowledge of JavaCC syntax< /li> < / span >
< span class = "dtd_comment" > < /ol> < / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > < h3> Syntax overview< /h3> < / span >
< span class = "dtd_comment" > Search syntax consists of two types of elements:< / span >
< span class = "dtd_comment" > < ul> < / span >
< span class = "dtd_comment" > < li> < i> Queries< /i> < /li> < / span >
< span class = "dtd_comment" > < li> < i> Filters< /i> < /li> < / span >
< span class = "dtd_comment" > < /ul> < / span >
< span class = "dtd_comment" > < h4> Queries< /h4> < / span >
< span class = "dtd_comment" > The root of any XML search must be a < i> Query< /i> 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 < a href=" #UserQuery" > UserQuery< /a> 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" > < h4> Filters< /h4> < / span >
< span class = "dtd_comment" > 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).< / 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 < a href=" http://java.sun.com/j2se/1.4.2/docs/api/java/util/BitSet.html" > Bitset< /a> for< / span >
< span class = "dtd_comment" > subsequent reuse (see < a href=" #CachedFilter" > CachedFilter< /a> tag).< / span >
< span class = "dtd_comment" > < h4> Nesting elements< /h4> < / 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 < a href=" #BooleanQuery" > BooleanQuery< /a> 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" > < h3> Advanced topics< /h3> < / span >
< span class = "dtd_comment" > < h4> Advanced positional testing - span queries< /h4> < / span >
< span class = "dtd_comment" > The < i> SpanQuery< /i> 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" > --> < / span >
< span class = "dtd_comment" > < !-- < / span > < span class = "dtd_dtddoc_tag" > @hidden< / span > < span class = "dtd_comment" > Define core types of XML elements --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " SpanOr|SpanNear|SpanOrTerms|SpanFirst|SpanNot|SpanTerm" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " BooleanQuery|UserQuery|FilteredQuery|TermQuery|TermsQuery|MatchAllDocsQuery|ConstantScoreQuery" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " RangeFilter|CachedFilter" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- < / span > < span class = "dtd_dtddoc_tag" > @hidden< / span > < span class = "dtd_comment" > Allow for extensions --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " " < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " " < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " " < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " %coreSpanQueries;%extendedSpanQueries1;" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " %coreQueries;|%spanQueries;%extendedQueries1;" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " %coreFilters;%extendedFilters1;" < / span > < span class = "dtd_plain" > < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !--< / 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" > < em> Find articles about banks, preferably talking about mergers but nothing to do with " sumitomo" < /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < BooleanQuery fieldName=" contents" > < / span >
< span class = "dtd_comment" > < Clause occurs=" should" > < / span >
< span class = "dtd_comment" > < TermQuery> merger< /TermQuery> < / span >
< span class = "dtd_comment" > < /Clause> < / span >
< span class = "dtd_comment" > < Clause occurs=" mustnot" > < / span >
< span class = "dtd_comment" > < TermQuery> sumitomo< /TermQuery> < / span >
< span class = "dtd_comment" > < /Clause> < / span >
< span class = "dtd_comment" > < Clause occurs=" must" > < / span >
< span class = "dtd_comment" > < TermQuery> bank< /TermQuery> < / span >
< span class = "dtd_comment" > < /Clause> < / span >
< span class = "dtd_comment" > < /BooleanQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- fieldName can optionally be defined here as a default attribute used by all child elements --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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. --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " false" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- The minimum number of optional clauses that should be present in any one document before it is considered to be a match. --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- NOTE: " Clause" tag has 2 modes of use - inside < BooleanQuery> in which case only " query" types can be< / span >
< span class = "dtd_comment" > child elements - while in a < BooleanFilter> clause only " filter" 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" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Controls if the clause is optional (should), mandatory (must) or unacceptable (mustNot) --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " should" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Search for documents about banks from the last 10 years - caching the commonly-used " last 10 year" filter as a BitSet in < / span >
< span class = "dtd_comment" > RAM to eliminate the cost of building this filter from disk for every query< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < FilteredQuery> < / span >
< span class = "dtd_comment" > < Query> < / span >
< span class = "dtd_comment" > < UserQuery> bank< /UserQuery> < / span >
< span class = "dtd_comment" > < /Query> < / span >
< span class = "dtd_comment" > < Filter> < / span >
< span class = "dtd_comment" > < CachedFilter> < / span >
< span class = "dtd_comment" > < RangeFilter fieldName=" date" lowerTerm=" 19970101" upperTerm=" 20070101" /> < / span >
< span class = "dtd_comment" > < /CachedFilter> < / span >
< span class = "dtd_comment" > < /Filter> < / span >
< span class = "dtd_comment" > < /FilteredQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !--< / span >
< span class = "dtd_comment" > Passes content directly through to the standard LuceneQuery parser see " Lucene Query Syntax" < / span >
< span class = "dtd_comment" > < / span > < span class = "dtd_dtddoc_tag" > @example< / span > < span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > < em> Search for documents about John Smith or John Doe using standard LuceneQuerySyntax< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < UserQuery> " John Smith" OR " John Doe" < /UserQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
2008-07-08 17:50:06 -04:00
< span class = "dtd_comment" > < !-- fieldName can optionally be defined here to change the default field used in the QueryParser --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
2007-10-09 17:45:27 -04:00
< span class = "dtd_comment" > < !-- A query which is used to match all documents. This has a couple of uses: < / span >
< span class = "dtd_comment" > < ol> < / span >
< span class = "dtd_comment" > < li> as a Clause in a BooleanQuery who's only other clause< / span >
< span class = "dtd_comment" > is a " mustNot" match (Lucene requires at least one positive clause) and..< /li> < / span >
< span class = "dtd_comment" > < li> 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.< /li> < / span >
< span class = "dtd_comment" > < /ol> < / 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" > < em> Effectively use a Filter as a query < /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < FilteredQuery> < / span >
< span class = "dtd_comment" > < Query> < / span >
< span class = "dtd_comment" > < MatchAllDocsQuery/> < / span >
< span class = "dtd_comment" > < /Query> < / span >
< span class = "dtd_comment" > < Filter> < / span >
< span class = "dtd_comment" > < RangeFilter fieldName=" date" lowerTerm=" 19870409" upperTerm=" 19870412" /> < / span >
< span class = "dtd_comment" > < /Filter> < / span >
< span class = "dtd_comment" > < /FilteredQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Match on a primary key< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < TermQuery fieldName=" primaryKey" > 13424< /TermQuery> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a " fieldName" attribute --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- < / 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" > < em> 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< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < TermsQuery fieldName=" description" > Smith & Sons (Ltd) : incorporated 1982< /TermsQuery> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a " fieldName" attribute --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The " Coordination factor" rewards documents that contain more of the terms in this list. This flag can be used to turn off this factor. --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " false" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- The minimum number of terms that should be present in any one document before it is considered to be a match. --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- < / 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" > < em> Find all documents about Lucene that have a status of " published" < /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < FilteredQuery> < / span >
< span class = "dtd_comment" > < Query> < / span >
< span class = "dtd_comment" > < UserQuery> Lucene< /UserQuery> < / span >
< span class = "dtd_comment" > < /Query> < / span >
< span class = "dtd_comment" > < Filter> < / span >
< span class = "dtd_comment" > < TermsFilter fieldName=" status" > published< /TermsFilter> < / span >
< span class = "dtd_comment" > < /Filter> < / span >
< span class = "dtd_comment" > < /FilteredQuery> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- Used to identify a nested Query element inside another container element. NOT a top-level query tag --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The choice of Filter that MUST also be matched --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !--< / 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" > < em> Search for documents about banks from the last 10 years< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < FilteredQuery> < / span >
< span class = "dtd_comment" > < Query> < / span >
< span class = "dtd_comment" > < UserQuery> bank< /UserQuery> < / span >
< span class = "dtd_comment" > < /Query> < / span >
< span class = "dtd_comment" > < Filter> < / span >
< span class = "dtd_comment" > < RangeFilter fieldName=" date" lowerTerm=" 19970101" upperTerm=" 20070101" /> < / span >
< span class = "dtd_comment" > < /Filter> < / span >
< span class = "dtd_comment" > < /FilteredQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a " fieldName" attribute --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The lower-most term value for this field (must be < = upperTerm) --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The upper-most term value for this field (must be > = lowerTerm) --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Controls if the lowerTerm in the range is part of the allowed set of values --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " true" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- Controls if the upperTerm in the range is part of the allowed set of values --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " true" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- A single term used in a SpanQuery. These clauses are the building blocks for more complex " span" queries which test word proximity< / span >
< span class = "dtd_comment" > < / span > < span class = "dtd_dtddoc_tag" > @example< / span > < span class = "dtd_comment" > < em> Find documents using terms close to each other about mining and accidents< /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < SpanNear slop=" 8" inOrder=" false" fieldName=" text" > < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> killed< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> died< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> dead< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> miner< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> mining< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> miners< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < /SpanNear> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a " fieldName" attribute --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> 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< /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < SpanNear slop=" 8" inOrder=" false" fieldName=" text" > < / span >
< span class = "dtd_comment" > < SpanOrTerms> killed died death dead deaths< /SpanOrTerms> < / span >
< span class = "dtd_comment" > < SpanOrTerms> miner mining miners< /SpanOrTerms> < / span >
< span class = "dtd_comment" > < /SpanNear> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- fieldName must be defined here or is taken from the most immediate parent XML element that defines a " fieldName" attribute --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Find documents using terms close to each other about mining and accidents< /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < SpanNear slop=" 8" inOrder=" false" fieldName=" text" > < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> killed< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> died< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> dead< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> miner< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> mining< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> miners< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < /SpanNear> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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 " boost attr (could add to SpanBuilderBase)< / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Find documents using terms within 8 words of each other talking about mining and accidents< /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < SpanNear slop=" 8" inOrder=" false" fieldName=" text" > < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> killed< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> died< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> dead< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < SpanOr> < / span >
< span class = "dtd_comment" > < SpanTerm> miner< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> mining< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> miners< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanOr> < / span >
< span class = "dtd_comment" > < /SpanNear> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Controls if matching terms have to appear in the order listed or can be reversed --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " true" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Find letters where the first 50 words talk about a resignation:< /em> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < SpanFirst end=" 50" > < / span >
< span class = "dtd_comment" > < SpanOrTerms fieldName=" text" > resigning resign leave< /SpanOrTerms> < / span >
< span class = "dtd_comment" > < /SpanFirst> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Controls the end of the region considered in a document's field (expressed in word number, not byte offset) --> < / span > < span class = "dtd_plain" > < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Find documents talking about social services but not containing the word " public" < /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < SpanNot fieldName=" text" > < / span >
< span class = "dtd_comment" > < Include> < / span >
< span class = "dtd_comment" > < SpanNear slop=" 2" inOrder=" true" > < / span >
< span class = "dtd_comment" > < SpanTerm> social< /SpanTerm> < / span >
< span class = "dtd_comment" > < SpanTerm> services< /SpanTerm> < / span >
< span class = "dtd_comment" > < /SpanNear> < / span >
< span class = "dtd_comment" > < /Include> < / span >
< span class = "dtd_comment" > < Exclude> < / span >
< span class = "dtd_comment" > < SpanTerm> public< /SpanTerm> < / span >
< span class = "dtd_comment" > < /Exclude> < / span >
< span class = "dtd_comment" > < /SpanNot> < / span >
< span class = "dtd_comment" > % < / span >
< span class = "dtd_comment" > < / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The SpanQuery to find --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- The SpanQuery to be avoided --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- 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" > < em> Find all documents from the last 10 years < /em> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > < ConstantScoreQuery> < / span >
< span class = "dtd_comment" > < RangeFilter fieldName=" date" lowerTerm=" 19970101" upperTerm=" 20070101" /> < / span >
< span class = "dtd_comment" > < /ConstantScoreQuery> < / span >
< span class = "dtd_comment" > %< / span >
< span class = "dtd_comment" > --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > > < / span >
< span class = "dtd_comment" > < !-- Optional boost for matches on this query. Values > 1 --> < / span >
< span class = "dtd_tag_symbols" > < !< / 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" > " 1.0" < / span > < span class = "dtd_tag_symbols" > > < / span >
< / pre >
< / body > < / html >