⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 package.html

📁 Lucene.Net 版本源码 测试通过
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head>   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">   <meta name="Author" content="Doug Cutting">   <meta content="Grant Ingersoll"  name="Author"></head><body><h2>Table Of Contents</h2><p>    <ol>        <li><a href="#search">Search Basics</a></li>        <li><a href="#query">The Query Classes</a></li>        <li><a href="#scoring">Changing the Scoring</a></li>    </ol></p><a name="search"></a><h2>Search</h2><p>Search over indices.Applications usually call {@linkLucene.Net.Search.Searcher#search(Query)} or {@linkLucene.Net.Search.Searcher#search(Query,Filter)}.    <!-- FILL IN MORE HERE -->   </p><a name="query"></a><h2>Query Classes</h2><h4>    <a href="TermQuery.html">TermQuery</a></h4><p>Of the various implementations of    <a href="Query.html">Query</a>, the    <a href="TermQuery.html">TermQuery</a>    is the easiest to understand and the most often used in applications. A <a        href="TermQuery.html">TermQuery</a> matches all the documents that contain the    specified    <a href="../index/Term.html">Term</a>,    which is a word that occurs in a certain    <a href="../document/Field.html">Field</a>.    Thus, a <a href="TermQuery.html">TermQuery</a> identifies and scores all    <a href="../document/Document.html">Document</a>s that have a <a        href="../document/Field.html">Field</a> with the specified string in it.    Constructing a <a        href="TermQuery.html">TermQuery</a>    is as simple as:    <pre>        TermQuery tq = new TermQuery(new Term("fieldName", "term");    </pre>In this example, the <a href="Query.html">Query</a> identifies all <a        href="../document/Document.html">Document</a>s that have the <a        href="../document/Field.html">Field</a> named <tt>"fieldName"</tt> and    contain the word <tt>"term"</tt>.</p><h4>    <a href="BooleanQuery.html">BooleanQuery</a></h4><p>Things start to get interesting when one combines multiple    <a href="TermQuery.html">TermQuery</a> instances into a <a        href="BooleanQuery.html">BooleanQuery</a>.    A <a href="BooleanQuery.html">BooleanQuery</a> contains multiple    <a href="BooleanClause.html">BooleanClause</a>s,    where each clause contains a sub-query (<a href="Query.html">Query</a>    instance) and an operator (from <a        href="BooleanClause.Occur.html">BooleanClause.Occur</a>)    describing how that sub-query is combined with the other clauses:    <ol>        <li><p>SHOULD -- Use this operator when a clause can occur in the result set, but is not required.            If a query is made up of all SHOULD clauses, then every document in the result            set matches at least one of these clauses.</p></li>        <li><p>MUST -- Use this operator when a clause is required to occur in the result set. Every            document in the result set will match            all such clauses.</p></li>        <li><p>MUST NOT -- Use this operator when a            clause must not occur in the result set. No            document in the result set will match            any such clauses.</p></li>    </ol>    Boolean queries are constructed by adding two or more    <a href="BooleanClause.html">BooleanClause</a>    instances. If too many clauses are added, a <a href="BooleanQuery.TooManyClauses.html">TooManyClauses</a>    exception will be thrown during searching. This most often occurs    when a <a href="Query.html">Query</a>    is rewritten into a <a href="BooleanQuery.html">BooleanQuery</a> with many    <a href="TermQuery.html">TermQuery</a> clauses,    for example by <a href="WildcardQuery.html">WildcardQuery</a>.    The default setting for the maximum number    of clauses 1024, but this can be changed via the    static method <a href="BooleanQuery.html#setMaxClauseCount(int)">setMaxClauseCount</a>    in <a href="BooleanQuery.html">BooleanQuery</a>.</p><h4>Phrases</h4><p>Another common search is to find documents containing certain phrases. This    is handled in two different ways.    <ol>        <li>            <p><a href="PhraseQuery.html">PhraseQuery</a>                -- Matches a sequence of                <a href="../index/Term.html">Terms</a>.                <a href="PhraseQuery.html">PhraseQuery</a> uses a slop factor to determine                how many positions may occur between any two terms in the phrase and still be considered a match.</p>        </li>        <li>            <p><a href="spans/SpanNearQuery.html">SpanNearQuery</a>                -- Matches a sequence of other                <a href="spans/SpanQuery.html">SpanQuery</a>                instances. <a href="spans/SpanNearQuery.html">SpanNearQuery</a> allows for                much more                complicated phrase queries since it is constructed from other to <a                    href="spans/SpanQuery.html">SpanQuery</a>                instances, instead of only <a href="TermQuery.html">TermQuery</a>                instances.</p>        </li>    </ol></p><h4>    <a href="RangeQuery.html">RangeQuery</a></h4><p>The    <a href="RangeQuery.html">RangeQuery</a>    matches all documents that occur in the    exclusive range of a lower    <a href="../index/Term.html">Term</a>    and an upper    <a href="../index/Term.html">Term</a>.    For example, one could find all documents    that have terms beginning with the letters <tt>a</tt> through <tt>c</tt>. This type of <a        href="Query.html">Query</a> is frequently used to    find    documents that occur in a specific date range.</p><h4>    <a href="PrefixQuery.html">PrefixQuery</a>,    <a href="WildcardQuery.html">WildcardQuery</a></h4><p>While the    <a href="PrefixQuery.html">PrefixQuery</a>    has a different implementation, it is essentially a special case of the    <a href="WildcardQuery.html">WildcardQuery</a>.    The <a href="PrefixQuery.html">PrefixQuery</a> allows an application    to identify all documents with terms that begin with a certain string. The <a        href="WildcardQuery.html">WildcardQuery</a> generalizes this by allowing    for the use of <tt>*</tt> (matches 0 or more characters) and <tt>?</tt> (matches exactly one character) wildcards.    Note that the <a href="WildcardQuery.html">WildcardQuery</a> can be quite slow. Also    note that    <a href="WildcardQuery.html">WildcardQuery</a> should    not start with <tt>*</tt> and <tt>?</tt>, as these are extremely slow. For tricks on how to search using a wildcard    at    the beginning of a term, see    <a href="http://www.gossamer-threads.com/lists/lucene/java-user/13373#13373">        Starts With x and Ends With x Queries</a>    from the Lucene users's mailing list.</p><h4>    <a href="FuzzyQuery.html">FuzzyQuery</a></h4><p>A    <a href="FuzzyQuery.html">FuzzyQuery</a>    matches documents that contain terms similar to the specified term. Similarity is    determined using    <a href="http://en.wikipedia.org/wiki/Levenshtein">Levenshtein (edit) distance</a>.    This type of query can be useful when accounting for spelling variations in the collection.</p><a name="changingSimilarity"></a><h2>Changing Similarity</h2><p>Chances are <a href="DefaultSimilarity.html">DefaultSimilarity</a> is sufficient for all    your searching needs.    However, in some applications it may be necessary to customize your <a        href="Similarity.html">Similarity</a> implementation. For instance, some

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -