blob: 61838b8707e314e8b5d2b20ccb2f269ab33d358f [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3"/>
<title>Lucene.Net: Lucene.Net.Search.FieldCacheTermsFilter Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="lucene-net-icon-128x128.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Lucene.Net
&#160;<span id="projectnumber">3.0.3</span>
</div>
<div id="projectbrief">Lucene.Net is a .NET port of the Java Lucene Indexing Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="Index.html"><span>Main&#160;Page</span></a></li>
<li><a href="namespaces.html"><span>Packages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Properties</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_lucene.html">Lucene</a></li><li class="navelem"><a class="el" href="namespace_lucene_1_1_net.html">Net</a></li><li class="navelem"><a class="el" href="namespace_lucene_1_1_net_1_1_search.html">Search</a></li><li class="navelem"><a class="el" href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter.html">FieldCacheTermsFilter</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Lucene.Net.Search.FieldCacheTermsFilter Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html" title="Abstract base class for restricting which documents may be returned during searching.">Filter</a> that only accepts documents whose single term value in the specified field is contained in the provided set of allowed terms.
<a href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter.html#details">More...</a></p>
<p>Inherits <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html">Lucene.Net.Search.Filter</a>.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><b>FieldCacheTermsFilterDocIdSet</b></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a98790c0e4b856facc7e71e57295ee118"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter.html#a98790c0e4b856facc7e71e57295ee118">FieldCacheTermsFilter</a> (string field, params string[] terms)</td></tr>
<tr class="separator:a98790c0e4b856facc7e71e57295ee118"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0da6373b91326e10ba978415ebddc898"><td class="memItemLeft" align="right" valign="top">override <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html">DocIdSet</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter.html#a0da6373b91326e10ba978415ebddc898">GetDocIdSet</a> (<a class="el" href="_more_like_this_8cs.html#a2a6914ea10bbe06764856e29e5674e66">IndexReader</a> reader)</td></tr>
<tr class="memdesc:a0da6373b91326e10ba978415ebddc898"><td class="mdescLeft">&#160;</td><td class="mdescRight"> <a href="#a0da6373b91326e10ba978415ebddc898"></a><br/></td></tr>
<tr class="separator:a0da6373b91326e10ba978415ebddc898"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:ad025d491fcea3bde0e3ad439c22c011f"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="interface_lucene_1_1_net_1_1_search_1_1_field_cache.html">FieldCache</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_lucene_1_1_net_1_1_search_1_1_field_cache_terms_filter.html#ad025d491fcea3bde0e3ad439c22c011f">FieldCache</a><code> [get]</code></td></tr>
<tr class="separator:ad025d491fcea3bde0e3ad439c22c011f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html" title="Abstract base class for restricting which documents may be returned during searching.">Filter</a> that only accepts documents whose single term value in the specified field is contained in the provided set of allowed terms. </p>
<p>This is the same functionality as <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_terms_filter.html" title="A filter that contains multiple terms. ">TermsFilter</a> (from contrib/queries), except this filter requires that the field contains only a single term for all documents. Because of drastically different implementations, they also have different performance characteristics, as described below.</p>
<p>The first invocation of this filter on a given field will be slower, since a <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_string_index.html" title="Expert: Stores term text values and document ordering data. ">StringIndex</a> must be created. Subsequent invocations using the same field will re-use this cache. However, as with all functionality based on <a class="el" href="interface_lucene_1_1_net_1_1_search_1_1_field_cache.html">FieldCache</a>, persistent RAM is consumed to hold the cache, and is not freed until the <a class="el" href="_reader_util_8cs.html#a2a6914ea10bbe06764856e29e5674e66">IndexReader</a> is closed. In contrast, <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_terms_filter.html" title="A filter that contains multiple terms. ">TermsFilter</a> has no persistent RAM consumption.</p>
<p>With each search, this filter translates the specified set of Terms into a private <a class="el" href="_span_query_filter_8cs.html#a39e4630d91e4f7fc118eb51aa4d221a0">OpenBitSet</a> keyed by term number per unique <a class="el" href="_reader_util_8cs.html#a2a6914ea10bbe06764856e29e5674e66">IndexReader</a> (normally one reader per segment). Then, during matching, the term number for each docID is retrieved from the cache and then checked for inclusion using the <a class="el" href="_span_query_filter_8cs.html#a39e4630d91e4f7fc118eb51aa4d221a0">OpenBitSet</a>. Since all testing is done using RAM resident data structures, performance should be very fast, most likely fast enough to not require further caching of the <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html" title="A DocIdSet contains a set of doc ids. Implementing classes must only implement Iterator to provide ac...">DocIdSet</a> for each possible combination of terms. However, because docIDs are simply scanned linearly, an index with a great many small documents may find this linear scan too costly.</p>
<p>In contrast, <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_terms_filter.html" title="A filter that contains multiple terms. ">TermsFilter</a> builds up an <a class="el" href="_span_query_filter_8cs.html#a39e4630d91e4f7fc118eb51aa4d221a0">OpenBitSet</a>, keyed by docID, every time it's created, by enumerating through all matching docs using <a class="el" href="_term_scorer_8cs.html#a058de2d1c801e53325f35357f213391f">TermDocs</a> to seek and scan through each term's docID list. While there is no linear scan of all docIDs, besides the allocation of the underlying array in the <a class="el" href="_span_query_filter_8cs.html#a39e4630d91e4f7fc118eb51aa4d221a0">OpenBitSet</a>, this approach requires a number of "disk seeks" in proportion to the number of terms, which can be exceptionally costly when there are cache misses in the OS's IO cache.</p>
<p>Generally, this filter will be slower on the first invocation for a given field, but subsequent invocations, even if you change the allowed set of Terms, should be faster than <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_terms_filter.html" title="A filter that contains multiple terms. ">TermsFilter</a>, especially as the number of Terms being matched increases. If you are matching only a very small number of terms, and those terms in turn match a very small number of documents, <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_terms_filter.html" title="A filter that contains multiple terms. ">TermsFilter</a> may perform faster.</p>
<p>Which filter is best is very application dependent. </p>
<p>Definition at line <a class="el" href="_field_cache_terms_filter_8cs_source.html#l00097">97</a> of file <a class="el" href="_field_cache_terms_filter_8cs_source.html">FieldCacheTermsFilter.cs</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a98790c0e4b856facc7e71e57295ee118"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Lucene.Net.Search.FieldCacheTermsFilter.FieldCacheTermsFilter </td>
<td>(</td>
<td class="paramtype">string&#160;</td>
<td class="paramname"><em>field</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">params string[]&#160;</td>
<td class="paramname"><em>terms</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_field_cache_terms_filter_8cs_source.html#l00102">102</a> of file <a class="el" href="_field_cache_terms_filter_8cs_source.html">FieldCacheTermsFilter.cs</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a0da6373b91326e10ba978415ebddc898"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">override <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html">DocIdSet</a> Lucene.Net.Search.FieldCacheTermsFilter.GetDocIdSet </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_more_like_this_8cs.html#a2a6914ea10bbe06764856e29e5674e66">IndexReader</a>&#160;</td>
<td class="paramname"><em>reader</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p></p>
<p>Creates a <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html" title="A DocIdSet contains a set of doc ids. Implementing classes must only implement Iterator to provide ac...">DocIdSet</a> enumerating the documents that should be permitted in search results. <b>NOTE:</b> null can be returned if no documents are accepted by this <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html" title="Abstract base class for restricting which documents may be returned during searching.">Filter</a>.</p>
<p>Note: This method will be called once per segment in the index during searching. The returned <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html" title="A DocIdSet contains a set of doc ids. Implementing classes must only implement Iterator to provide ac...">DocIdSet</a> must refer to document IDs for that segment, not for the top-level reader.</p>
<p>/summary&gt; </p>
<dl class="section return"><dt>Returns</dt><dd>a <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_doc_id_set.html" title="A DocIdSet contains a set of doc ids. Implementing classes must only implement Iterator to provide ac...">DocIdSet</a> that provides the documents which should be permitted or prohibited in search results. <b>NOTE:</b> null can be returned if no documents will be accepted by this <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html" title="Abstract base class for restricting which documents may be returned during searching.">Filter</a>. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">reader</td><td>A <a class="el" href="_reader_util_8cs.html#a2a6914ea10bbe06764856e29e5674e66">IndexReader</a> instance opened on the index currently searched on. Note, it is likely that the provided reader does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="_filter_8cs.html#a673a4822c0bf5f5fdadb59f7ad92338c">DocIdBitSet</a></dd></dl>
<p>Implements <a class="el" href="class_lucene_1_1_net_1_1_search_1_1_filter.html#a6acd9f9caec9c3a4adba5580593f76c7">Lucene.Net.Search.Filter</a>.</p>
<p>Definition at line <a class="el" href="_field_cache_terms_filter_8cs_source.html#l00113">113</a> of file <a class="el" href="_field_cache_terms_filter_8cs_source.html">FieldCacheTermsFilter.cs</a>.</p>
</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a class="anchor" id="ad025d491fcea3bde0e3ad439c22c011f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="interface_lucene_1_1_net_1_1_search_1_1_field_cache.html">FieldCache</a> Lucene.Net.Search.FieldCacheTermsFilter.FieldCache</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Definition at line <a class="el" href="_field_cache_terms_filter_8cs_source.html#l00109">109</a> of file <a class="el" href="_field_cache_terms_filter_8cs_source.html">FieldCacheTermsFilter.cs</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>core/Search/<a class="el" href="_field_cache_terms_filter_8cs_source.html">FieldCacheTermsFilter.cs</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Jan 3 2013 02:12:56 for Lucene.Net by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3
</small></address>
</body>
</html>