blob: 657b087565956bf6b9ae65f616eb1c292cbd3307 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Namespace Lucene.Net.Facet
| Apache Lucene.NET 4.8.0-beta00013 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Namespace Lucene.Net.Facet
| Apache Lucene.NET 4.8.0-beta00013 Documentation ">
<meta name="generator" content="docfx 2.56.2.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<span id="forkongithub"><a href="https://github.com/apache/lucenenet" target="_blank">Fork me on GitHub</a></span>
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="article row grid">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Facet">
<h1 id="Lucene_Net_Facet" data-uid="Lucene.Net.Facet" class="text-break">Namespace Lucene.Net.Facet
</h1>
<div class="markdown level0 summary"><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<p>Provides faceted indexing and search capabilities. Checkout <a href="http://shaierera.blogspot.com/2012/11/lucene-facets-part-1.html">this</a>
and <a href="http://shaierera.blogspot.com/2012/11/lucene-facets-part-2.html">this</a> blog posts for some overview on the facets module
as well as source code examples <a href="../demo">here</a>.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="markdown level0 remarks"></div>
<h3 id="classes">Classes
</h3>
<h4><a class="xref" href="Lucene.Net.Facet.DrillDownQuery.html">DrillDownQuery</a></h4>
<section><p>A <span class="xref">Lucene.Net.Search.Query</span> for drill-down over facet categories. You
should call <a class="xref" href="Lucene.Net.Facet.DrillDownQuery.html#Lucene_Net_Facet_DrillDownQuery_Add_System_String_System_String___">Add(String, String[])</a> for every group of categories you
want to drill-down over.
<p>
<strong>NOTE:</strong> if you choose to create your own <span class="xref">Lucene.Net.Search.Query</span> by calling
<a class="xref" href="Lucene.Net.Facet.DrillDownQuery.html#Lucene_Net_Facet_DrillDownQuery_Term_System_String_System_String_System_String___">Term(String, String, String[])</a>, it is recommended to wrap it with <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Search.ConstantScoreQuery.html">ConstantScoreQuery</a>
and set the <span class="xref">Lucene.Net.Search.Query.Boost</span> to <code>0.0f</code>,
so that it does not affect the scores of the documents.</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div><p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.DrillSideways.html">DrillSideways</a></h4>
<section><p>Computes drill down and sideways counts for the provided
<a class="xref" href="Lucene.Net.Facet.DrillDownQuery.html">DrillDownQuery</a>. Drill sideways counts include
alternative values/aggregates for the drill-down
dimensions so that a dimension does not disappear after
the user drills down into it.</p>
<p> Use one of the static search
methods to do the search, and then get the hits and facet
results from the returned <a class="xref" href="Lucene.Net.Facet.DrillSidewaysResult.html">DrillSidewaysResult</a>.
</p>
<p><strong>NOTE</strong>: this allocates one <a class="xref" href="Lucene.Net.Facet.FacetsCollector.html">FacetsCollector</a>
for each drill-down, plus one. If your
index has high number of facet labels then this will
multiply your memory usage.
@lucene.experimental
</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.DrillSidewaysResult.html">DrillSidewaysResult</a></h4>
<section><p>Result of a drill sideways search, including the
<a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> and <span class="xref">Lucene.Net.Search.TopDocs</span>. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetField.html">FacetField</a></h4>
<section><p>Add an instance of this to your <span class="xref">Lucene.Net.Documents.Document</span> for every facet label.</p>
<p>
<strong>NOTE:</strong> you must call <a class="xref" href="Lucene.Net.Facet.FacetsConfig.html#Lucene_Net_Facet_FacetsConfig_Build_Lucene_Net_Documents_Document_">Build(Document)</a> before
you add the document to <span class="xref">Lucene.Net.Index.IndexWriter</span>.
</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetResult.html">FacetResult</a></h4>
<section><p>Counts or aggregates for a single dimension.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a></h4>
<section><p>Common base class for all facets implementations.</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div><p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetsCollector.html">FacetsCollector</a></h4>
<section><p>Collects hits for subsequent faceting. Once you&apos;ve run
a search and collect hits into this, instantiate one of
the <span class="xref">Lucene.Net.Search.ICollector</span> subclasses to do the facet
counting. Use the Search utility methods (such as <a class="xref" href="Lucene.Net.Facet.FacetsCollector.html#Lucene_Net_Facet_FacetsCollector_Search_Lucene_Net_Search_IndexSearcher_Lucene_Net_Search_Query_System_Int32_Lucene_Net_Search_ICollector_">Search(IndexSearcher, Query, Int32, ICollector)</a>) to
perform an &quot;ordinary&quot; search but also collect into a
<a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a>. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetsCollector.Docs.html">FacetsCollector.Docs</a></h4>
<section><p>Used during collection to record matching docs and then return a
<a class="xref" href="Lucene.Net.Facet.FacetsCollector.Docs.html#Lucene_Net_Facet_FacetsCollector_Docs_DocIdSet">DocIdSet</a> that contains them.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetsCollector.MatchingDocs.html">FacetsCollector.MatchingDocs</a></h4>
<section><p>Holds the documents that were matched in the <span class="xref">Lucene.Net.Index.AtomicReaderContext</span>.
If scores were required, then <a class="xref" href="Lucene.Net.Facet.FacetsCollector.MatchingDocs.html#Lucene_Net_Facet_FacetsCollector_MatchingDocs_Scores">Scores</a> is not <code>null</code>.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetsConfig.html">FacetsConfig</a></h4>
<section><p>Records per-dimension configuration. By default a
dimension is flat, single valued and does
not require count for the dimension; use
the setters in this class to change these settings for
each dim.</p>
<p>
<strong>NOTE</strong>: this configuration is not saved into the
index, but it&apos;s vital, and up to the application to
ensure, that at search time the provided <a class="xref" href="Lucene.Net.Facet.FacetsConfig.html">FacetsConfig</a>
matches what was used during indexing.
@lucene.experimental
</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.FacetsConfig.DimConfig.html">FacetsConfig.DimConfig</a></h4>
<section><p>Holds the configuration for one dimension</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div><p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.LabelAndValue.html">LabelAndValue</a></h4>
<section><p>Single label and its value, usually contained in a
<a class="xref" href="Lucene.Net.Facet.FacetResult.html">FacetResult</a>. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.MultiFacets.html">MultiFacets</a></h4>
<section><p>Maps specified dims to provided <a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> impls; else, uses
the default <a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> impl. </p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.OrdAndValue-1.html">OrdAndValue&lt;T&gt;</a></h4>
<section><p>Holds a single entry.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.RandomSamplingFacetsCollector.html">RandomSamplingFacetsCollector</a></h4>
<section><p>Collects hits for subsequent faceting, using sampling if needed. Once you&apos;ve
run a search and collect hits into this, instantiate one of the
<a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> subclasses to do the facet counting. Note that this collector
does not collect the scores of matching docs (i.e.
<a class="xref" href="Lucene.Net.Facet.FacetsCollector.MatchingDocs.html#Lucene_Net_Facet_FacetsCollector_MatchingDocs_Scores">Scores</a>) is <code>null</code>.
<p>
If you require the original set of hits, you can call
<a class="xref" href="Lucene.Net.Facet.RandomSamplingFacetsCollector.html#Lucene_Net_Facet_RandomSamplingFacetsCollector_GetOriginalMatchingDocs">GetOriginalMatchingDocs()</a>. Also, since the counts of the top-facets
is based on the sampled set, you can amortize the counts by calling
<a class="xref" href="Lucene.Net.Facet.RandomSamplingFacetsCollector.html#Lucene_Net_Facet_RandomSamplingFacetsCollector_AmortizeFacetCounts_Lucene_Net_Facet_FacetResult_Lucene_Net_Facet_FacetsConfig_Lucene_Net_Search_IndexSearcher_">AmortizeFacetCounts(FacetResult, FacetsConfig, IndexSearcher)</a>.
</p></p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.TopOrdAndInt32Queue.html">TopOrdAndInt32Queue</a></h4>
<section><p>Keeps highest results, first by largest <span class="xref">System.Int32</span> value,
then tie break by smallest ord.
<p>
NOTE: This was TopOrdAndIntQueue in Lucene</p>
</section>
<h4><a class="xref" href="Lucene.Net.Facet.TopOrdAndSingleQueue.html">TopOrdAndSingleQueue</a></h4>
<section><p>Keeps highest results, first by largest <span class="xref">System.Single</span> value,
then tie break by smallest ord.
<p>
NOTE: This was TopOrdAndFloatQueue in Lucene</p>
</section>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/blob/docs/4.8.0-beta00013/src/Lucene.Net.Facet/overview.md/#L2" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 The Apache Software Foundation, Licensed under the <a href='http://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache License, Version 2.0</a><br> <small>Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. <br>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</small>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>