| <!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.Taxonomy |
| | Apache Lucene.NET 4.8.0-beta00013 Documentation </title> |
| <meta name="viewport" content="width=device-width"> |
| <meta name="title" content="Namespace Lucene.Net.Facet.Taxonomy |
| | 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="facet/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="sidenav hide-when-search"> |
| <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a> |
| <div class="sidetoggle collapse" id="sidetoggle"> |
| <div id="sidetoc"></div> |
| </div> |
| </div> |
| <div class="article row grid-right"> |
| <div class="col-md-10"> |
| <article class="content wrap" id="_content" data-uid="Lucene.Net.Facet.Taxonomy"> |
| |
| <h1 id="Lucene_Net_Facet_Taxonomy" data-uid="Lucene.Net.Facet.Taxonomy" class="text-break">Namespace Lucene.Net.Facet.Taxonomy |
| </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. |
| --> |
| <h1 id="taxonomy-of-categories">Taxonomy of Categories</h1> |
| <pre><code>Facets are defined using a hierarchy of categories, known as a _Taxonomy_. |
| For example, the taxonomy of a book store application might have the following structure: |
| </code></pre><ul> |
| <li><p>Author</p> |
| <ul> |
| <li><p>Mark Twain</p> |
| </li> |
| <li><p>J. K. Rowling</p> |
| </li> |
| </ul> |
| </li> |
| <li><p>Date</p> |
| <ul> |
| <li><p>2010</p> |
| </li> |
| <li><p>March</p> |
| </li> |
| <li><p>April</p> |
| </li> |
| <li><p>2009</p> |
| </li> |
| </ul> |
| <p>The <em>Taxonomy</em> translates category-paths into interger identifiers (often termed <em>ordinals</em>) and vice versa. |
| The category <code>Author/Mark Twain</code> adds two nodes to the taxonomy: <code>Author</code> and |
| <code>Author/Mark Twain</code>, each is assigned a different ordinal. The taxonomy maintains the invariant that a |
| node always has an ordinal that is < all its children.</p> |
| </li> |
| </ul> |
| </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.Taxonomy.AssociationFacetField.html">AssociationFacetField</a></h4> |
| <section><p>Add an instance of this to your <span class="xref">Lucene.Net.Documents.Document</span> to add |
| a facet label associated with an arbitrary <span class="xref">byte[]</span>. |
| This will require a custom <a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> |
| implementation at search time; see <a class="xref" href="Lucene.Net.Facet.Taxonomy.Int32AssociationFacetField.html">Int32AssociationFacetField</a> |
| and <a class="xref" href="Lucene.Net.Facet.Taxonomy.SingleAssociationFacetField.html">SingleAssociationFacetField</a> to use existing |
| <a class="xref" href="Lucene.Net.Facet.Facets.html">Facets</a> 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.Taxonomy.CachedOrdinalsReader.html">CachedOrdinalsReader</a></h4> |
| <section><p>A per-segment cache of documents' facet ordinals. Every |
| <a class="xref" href="Lucene.Net.Facet.Taxonomy.CachedOrdinalsReader.CachedOrds.html">CachedOrdinalsReader.CachedOrds</a> holds the ordinals in a raw <span class="xref">int[]</span>, |
| and therefore consumes as much RAM as the total |
| number of ordinals found in the segment, but saves the |
| CPU cost of decoding ordinals during facet counting.</p> |
| <p> |
| <strong>NOTE:</strong> every <a class="xref" href="Lucene.Net.Facet.Taxonomy.CachedOrdinalsReader.CachedOrds.html">CachedOrdinalsReader.CachedOrds</a> is limited to 2.1B |
| total ordinals. If that is a limitation for you then |
| consider limiting the segment size to fewer documents, or |
| use an alternative cache which pages through the category |
| ordinals. |
| |
| </p> |
| <p> |
| <strong>NOTE:</strong> when using this cache, it is advised to use |
| a <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> that does not cache the data in |
| memory, at least for the category lists fields, or |
| otherwise you'll be doing double-caching. |
| |
| </p> |
| <p> |
| <strong>NOTE:</strong> create one instance of this and re-use it |
| for all facet implementations (the cache is per-instance, |
| not static). |
| </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.CachedOrdinalsReader.CachedOrds.html">CachedOrdinalsReader.CachedOrds</a></h4> |
| <section><p>Holds the cached ordinals in two parallel <span class="xref">int[]</span> arrays.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.CategoryPath.html">CategoryPath</a></h4> |
| <section><p>Holds a sequence of string components, specifying the hierarchical name of a |
| category.</p> |
| <div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.DocValuesOrdinalsReader.html">DocValuesOrdinalsReader</a></h4> |
| <section><p>Decodes ordinals previously indexed into a <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Index.BinaryDocValues.html">BinaryDocValues</a> field</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.FacetLabel.html">FacetLabel</a></h4> |
| <section><p>Holds a sequence of string components, specifying the hierarchical name of a |
| category.</p> |
| <div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.FastTaxonomyFacetCounts.html">FastTaxonomyFacetCounts</a></h4> |
| <section><p>Computes facets counts, assuming the default encoding |
| into DocValues was used.</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.Taxonomy.Int32AssociationFacetField.html">Int32AssociationFacetField</a></h4> |
| <section><p>Add an instance of this to your <span class="xref">Lucene.Net.Documents.Document</span> to add |
| a facet label associated with an <span class="xref">System.Int32</span>. Use <a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyFacetSumInt32Associations.html">TaxonomyFacetSumInt32Associations</a> |
| to aggregate int values per facet label at search time. |
| <p> |
| NOTE: This was IntAssociationFacetField in Lucene |
| <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.Taxonomy.Int32TaxonomyFacets.html">Int32TaxonomyFacets</a></h4> |
| <section><p>Base class for all taxonomy-based facets that aggregate |
| to a per-ords <span class="xref">int[]</span>. |
| <p> |
| NOTE: This was IntTaxonomyFacets in Lucene</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html">LruDictionary<TKey, TValue></a></h4> |
| <section><p><a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html">LruDictionary<TKey, TValue></a> is similar to of Java's HashMap, which has a bounded <a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html#Lucene_Net_Facet_Taxonomy_LruDictionary_2_Limit">Limit</a>; |
| When it reaches that <a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html#Lucene_Net_Facet_Taxonomy_LruDictionary_2_Limit">Limit</a>, each time a new element is added, the least |
| recently used (LRU) entry is removed. |
| <p> |
| Unlike the Java Lucene implementation, this one is thread safe because it is backed by the <span class="xref">J2N.Collections.Concurrent.LurchTable`2</span>. |
| Do note that every time an element is read from <a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html">LruDictionary<TKey, TValue></a>, |
| a write operation also takes place to update the element's last access time. |
| This is because the LRU order needs to be remembered to determine which element |
| to evict when the <a class="xref" href="Lucene.Net.Facet.Taxonomy.LruDictionary-2.html#Lucene_Net_Facet_Taxonomy_LruDictionary_2_Limit">Limit</a> is exceeded. |
| </p> |
| <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.Taxonomy.OrdinalsReader.html">OrdinalsReader</a></h4> |
| <section><p>Provides per-document ordinals. </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.OrdinalsReader.OrdinalsSegmentReader.html">OrdinalsReader.OrdinalsSegmentReader</a></h4> |
| <section><p>Returns ordinals for documents in one segment.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.ParallelTaxonomyArrays.html">ParallelTaxonomyArrays</a></h4> |
| <section><p>Returns 3 arrays for traversing the taxonomy: |
| <ul><li> <a class="xref" href="Lucene.Net.Facet.Taxonomy.ParallelTaxonomyArrays.html#Lucene_Net_Facet_Taxonomy_ParallelTaxonomyArrays_Parents">Parents</a>: <code>Parents[i]</code> denotes the parent of category |
| ordinal <code>i</code>.</li><li> <a class="xref" href="Lucene.Net.Facet.Taxonomy.ParallelTaxonomyArrays.html#Lucene_Net_Facet_Taxonomy_ParallelTaxonomyArrays_Children">Children</a>: <code>Children[i]</code> denotes a child of category ordinal |
| <code>i</code>.</li><li> <a class="xref" href="Lucene.Net.Facet.Taxonomy.ParallelTaxonomyArrays.html#Lucene_Net_Facet_Taxonomy_ParallelTaxonomyArrays_Siblings">Siblings</a>: <code>Siblings[i]</code> denotes the sibling of category |
| ordinal <code>i</code>.</li></ul></p> |
| <p>To traverse the taxonomy tree, you typically start with <code>Children[0]</code> |
| (ordinal 0 is reserved for ROOT), and then depends if you want to do DFS or |
| BFS, you call <code>Children[Children[0]]</code> or <code>Siblings[Children[0]]</code> |
| and so forth, respectively.</p> |
| <p> |
| <strong>NOTE:</strong> you are not expected to modify the values of the arrays, since |
| the arrays are shared with other threads. |
| |
| @lucene.experimental |
| </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.PrintTaxonomyStats.html">PrintTaxonomyStats</a></h4> |
| <section><p>Prints how many ords are under each dimension. </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.SearcherTaxonomyManager.html">SearcherTaxonomyManager</a></h4> |
| <section><p>Manages near-real-time reopen of both an <span class="xref">Lucene.Net.Search.IndexSearcher</span> |
| and a <a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyReader.html">TaxonomyReader</a>.</p> |
| <p> |
| <strong>NOTE</strong>: If you call <a class="xref" href="Lucene.Net.Facet.Taxonomy.Directory.DirectoryTaxonomyWriter.html#Lucene_Net_Facet_Taxonomy_Directory_DirectoryTaxonomyWriter_ReplaceTaxonomy_Lucene_Net_Store_Directory_">ReplaceTaxonomy(Directory)</a> |
| then you must open a new <a class="xref" href="Lucene.Net.Facet.Taxonomy.SearcherTaxonomyManager.html">SearcherTaxonomyManager</a> afterwards. |
| </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.SearcherTaxonomyManager.SearcherAndTaxonomy.html">SearcherTaxonomyManager.SearcherAndTaxonomy</a></h4> |
| <section><p>Holds a matched pair of <span class="xref">Lucene.Net.Search.IndexSearcher</span> and |
| <a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyReader.html">TaxonomyReader</a> </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.SingleAssociationFacetField.html">SingleAssociationFacetField</a></h4> |
| <section><p>Add an instance of this to your <span class="xref">Lucene.Net.Documents.Document</span> to add |
| a facet label associated with a <span class="xref">System.Single</span>. Use <a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyFacetSumSingleAssociations.html">TaxonomyFacetSumSingleAssociations</a> |
| to aggregate <span class="xref">System.Single</span> values per facet label at search time. |
| <p> |
| NOTE: This was FloatAssociationFacetField in Lucene |
| <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.Taxonomy.SingleTaxonomyFacets.html">SingleTaxonomyFacets</a></h4> |
| <section><p>Base class for all taxonomy-based facets that aggregate |
| to a per-ords <span class="xref">float[]</span>. |
| <p> |
| NOTE: This was FloatTaxonomyFacets in Lucene</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyFacetCounts.html">TaxonomyFacetCounts</a></h4> |
| <section><p>Reads from any <a class="xref" href="Lucene.Net.Facet.Taxonomy.OrdinalsReader.html">OrdinalsReader</a>; use <a class="xref" href="Lucene.Net.Facet.Taxonomy.FastTaxonomyFacetCounts.html">FastTaxonomyFacetCounts</a> |
| if you are using the default encoding from <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Index.BinaryDocValues.html">BinaryDocValues</a>.</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.Taxonomy.TaxonomyFacets.html">TaxonomyFacets</a></h4> |
| <section><p>Base class for all taxonomy-based facets impls.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyFacetSumInt32Associations.html">TaxonomyFacetSumInt32Associations</a></h4> |
| <section><p>Aggregates sum of <span class="xref">System.Int32</span> values previously indexed with |
| <a class="xref" href="Lucene.Net.Facet.Taxonomy.Int32AssociationFacetField.html">Int32AssociationFacetField</a>, assuming the default |
| encoding. |
| <p> |
| NOTE: This was TaxonomyFacetSumIntAssociations in Lucene</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.Taxonomy.TaxonomyFacetSumSingleAssociations.html">TaxonomyFacetSumSingleAssociations</a></h4> |
| <section><p>Aggregates sum of <span class="xref">System.Single</span> values previously indexed with |
| <a class="xref" href="Lucene.Net.Facet.Taxonomy.SingleAssociationFacetField.html">SingleAssociationFacetField</a>, assuming the default |
| encoding. |
| <p> |
| NOTE: This was TaxonomyFacetSumFloatAssociations in Lucene</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.Taxonomy.TaxonomyFacetSumValueSource.html">TaxonomyFacetSumValueSource</a></h4> |
| <section><p>Aggregates sum of values from <span class="xref">Lucene.Net.Queries.Function.FunctionValues.DoubleVal(System.Int32)</span> and <span class="xref">Lucene.Net.Queries.Function.FunctionValues.DoubleVal(System.Int32,System.Double[])</span>, |
| for each facet label.</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.Taxonomy.TaxonomyFacetSumValueSource.ScoreValueSource.html">TaxonomyFacetSumValueSource.ScoreValueSource</a></h4> |
| <section><p><span class="xref">Lucene.Net.Queries.Function.ValueSource</span> that returns the score for each |
| hit; use this to aggregate the sum of all hit scores |
| for each facet label. </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyReader.html">TaxonomyReader</a></h4> |
| <section><p>TaxonomyReader is the read-only interface with which the faceted-search |
| library uses the taxonomy during search time. |
| <p> |
| A TaxonomyReader holds a list of categories. Each category has a serial |
| number which we call an "ordinal", and a hierarchical "path" name: |
| <ul><li> |
| The ordinal is an integer that starts at 0 for the first category (which is |
| always the root category), and grows contiguously as more categories are |
| added; Note that once a category is added, it can never be deleted. |
| </li><li> |
| The path is a CategoryPath object specifying the category's position in the |
| hierarchy. |
| </li></ul> |
| </p> |
| <strong>Notes about concurrent access to the taxonomy:</strong> |
| <p> |
| An implementation must allow multiple readers to be active concurrently |
| with a single writer. Readers follow so-called "point in time" semantics, |
| i.e., a TaxonomyReader object will only see taxonomy entries which were |
| available at the time it was created. What the writer writes is only |
| available to (new) readers after the writer's <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> is called. |
| </p> |
| <p> |
| In faceted search, two separate indices are used: the main Lucene index, |
| and the taxonomy. Because the main index refers to the categories listed |
| in the taxonomy, it is important to open the taxonomy <em>after</em> opening the |
| main index, and it is also necessary to Reopen() the taxonomy after |
| Reopen()ing the main index. |
| </p> |
| <p> |
| This order is important, otherwise it would be possible for the main index |
| to refer to a category which is not yet visible in the old snapshot of |
| the taxonomy. Note that it is indeed fine for the the taxonomy to be opened |
| after the main index - even a long time after. The reason is that once |
| a category is added to the taxonomy, it can never be changed or deleted, |
| so there is no danger that a "too new" taxonomy not being consistent with |
| an older index. |
| </p></p> |
| <div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></section> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.TaxonomyReader.ChildrenEnumerator.html">TaxonomyReader.ChildrenEnumerator</a></h4> |
| <section><p>An iterator over a category's children.</p> |
| </section> |
| <h3 id="interfaces">Interfaces |
| </h3> |
| <h4><a class="xref" href="Lucene.Net.Facet.Taxonomy.ITaxonomyWriter.html">ITaxonomyWriter</a></h4> |
| <section><p><a class="xref" href="Lucene.Net.Facet.Taxonomy.ITaxonomyWriter.html">ITaxonomyWriter</a> is the interface which the faceted-search library uses |
| to dynamically build the taxonomy at indexing time. |
| <p> |
| Notes about concurrent access to the taxonomy: |
| </p> |
| <p> |
| An implementation must allow multiple readers and a single writer to be |
| active concurrently. Readers follow so-called "point in time" semantics, |
| i.e., a reader object will only see taxonomy entries which were available |
| at the time it was created. What the writer writes is only available to |
| (new) readers after the writer's <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> is called. |
| </p> |
| <p> |
| Faceted search keeps two indices - namely Lucene's main index, and this |
| taxonomy index. When one or more readers are active concurrently with the |
| writer, care must be taken to avoid an inconsistency between the state of |
| these two indices: When writing to the indices, the taxonomy must always |
| be committed to disk <em>before</em> the main index, because the main index |
| refers to categories listed in the taxonomy. |
| Such control can best be achieved by turning off the main index's |
| "autocommit" feature, and explicitly calling <a class="xref" href="https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Index.IndexWriter.html#Lucene_Net_Index_IndexWriter_Commit">Commit()</a> for both indices |
| (first for the taxonomy, then for the main index). |
| In old versions of Lucene (2.2 or earlier), when autocommit could not be |
| turned off, a more complicated solution needs to be used. E.g., use |
| some sort of (possibly inter-process) locking to ensure that a reader |
| is being opened only right after both indices have been flushed (and |
| before anything else is written to them). |
| </p></p> |
| <div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></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/Taxonomy/package.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> |