| <!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.Codecs |
| | Apache Lucene.NET 4.8.0-beta00011 Documentation </title> |
| <meta name="viewport" content="width=device-width"> |
| <meta name="title" content="Namespace Lucene.Net.Codecs |
| | Apache Lucene.NET 4.8.0-beta00011 Documentation "> |
| <meta name="generator" content="docfx 2.56.0.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="core/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"> |
| <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.Codecs"> |
| |
| <h1 id="Lucene_Net_Codecs" data-uid="Lucene.Net.Codecs" class="text-break">Namespace Lucene.Net.Codecs |
| </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>Codecs API: API for customization of the encoding and structure of the index.</p> |
| <p> The Codec API allows you to customize the way the following pieces of index information are stored:</p> |
| <ul> |
| <li>Postings lists - see <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a></li> |
| <li>DocValues - see <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a></li> |
| <li>Stored fields - see <a class="xref" href="Lucene.Net.Codecs.StoredFieldsFormat.html">StoredFieldsFormat</a></li> |
| <li>Term vectors - see <a class="xref" href="Lucene.Net.Codecs.TermVectorsFormat.html">TermVectorsFormat</a></li> |
| <li>FieldInfos - see <a class="xref" href="Lucene.Net.Codecs.FieldInfosFormat.html">FieldInfosFormat</a></li> |
| <li>SegmentInfo - see <a class="xref" href="Lucene.Net.Codecs.SegmentInfoFormat.html">SegmentInfoFormat</a></li> |
| <li>Norms - see <a class="xref" href="Lucene.Net.Codecs.NormsFormat.html">NormsFormat</a></li> |
| <li>Live documents - see <a class="xref" href="Lucene.Net.Codecs.LiveDocsFormat.html">LiveDocsFormat</a> </li> |
| </ul> |
| <p>For some concrete implementations beyond Lucene's official index format, see the <a href="../codecs/overview.html">Codecs module</a>.</p> |
| <p>Codecs are identified by name through the <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a> implementation, which by default is the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a>. To create your own codec, extend <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>. By default, the name of the class (minus the suffix "Codec") will be used as the codec's name.</p> |
| <pre><code class="lang-cs">// By default, the name will be "My" because the "Codec" suffix is removed |
| public class MyCodec : Codec |
| { |
| } |
| </code></pre><div class="NOTE"><h5>Note</h5><p>There is a built-in <a class="xref" href="Lucene.Net.Codecs.FilterCodec.html">FilterCodec</a> type that can be used to easily extend an existing codec type.</p> |
| </div> |
| <p>To override the default codec name, decorate the custom codec with the <a class="xref" href="Lucene.Net.Codecs.CodecNameAttribute.html">CodecNameAttribute</a>.</p> |
| <p>The <a class="xref" href="Lucene.Net.Codecs.CodecNameAttribute.html">CodecNameAttribute</a> can be used to set the name to that of a built-in codec to override its registration in the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a>. </p> |
| <pre><code class="lang-cs">[CodecName("MyCodec")] // Sets the codec name explicitly |
| public class MyCodec : Codec |
| { |
| } |
| </code></pre><p> Register the Codec class so Lucene.NET can find it either by providing it to the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> at application start up or by using a dependency injection container.</p> |
| <h2 id="using-microsoftextensionsdependencyinjection-to-register-a-custom-codec">Using Microsoft.Extensions.DependencyInjection to Register a Custom Codec</h2> |
| <p> First, create an <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a> implementation to return the type based on a string name. Here is a generic implementation, that can be used with almost any dependency injection container.</p> |
| <pre><code class="lang-cs">public class NamedCodecFactory : ICodecFactory, IServiceListable |
| { |
| private readonly IDictionary<string, Codec> codecs; |
| |
| public NamedCodecFactory(IEnumerable<Codec> codecs) |
| { |
| this.codecs = codecs.ToDictionary(n => n.Name); |
| } |
| |
| public ICollection<string> AvailableServices => codecs.Keys; |
| |
| public Codec GetCodec(string name) |
| { |
| if (codecs.TryGetValue(name, out Codec value)) |
| return value; |
| |
| throw new ArgumentException($"The codec {name} is not registered.", nameof(name)); |
| } |
| } |
| </code></pre><div class="NOTE"><h5>Note</h5><p>Implementing <a class="xref" href="Lucene.Net.Util.IServiceListable.html">IServiceListable</a> is optional. This allows for logging scenarios (such as those built into the test framework) to list the codecs that are registered.</p> |
| </div> |
| <p>Next, register all of the codecs that your Lucene.NET implementation will use and the <code>NamedCodecFactory</code> with dependency injection using singleton lifetime.</p> |
| <pre><code class="lang-cs">IServiceProvider services = new ServiceCollection() |
| .AddSingleton<Codec, Lucene.Net.Codecs.Lucene46.Lucene46Codec>() |
| .AddSingleton<Codec, MyCodec>() |
| .AddSingleton<ICodecFactory, NamedCodecFactory>() |
| .BuildServiceProvider(); |
| </code></pre><p>Finally, set the <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a> implementation Lucene.NET will use with the static <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec.SetCodecFactory(ICodecFactory)</a> method. This must be done one time at application start up.</p> |
| <pre><code class="lang-cs">Codec.SetCodecFactory(services.GetService<ICodecFactory>()); |
| </code></pre><h2 id="using-xreflucenenetcodecsdefaultcodecfactory-to-register-a-custom-codec">Using <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> to Register a Custom Codec</h2> |
| <p>If your application is not using dependency injection, you can register a custom codec by adding your codec at start up.</p> |
| <pre><code class="lang-cs">Codec.SetCodecFactory(new DefaultCodecFactory { |
| CustomCodecTypes = new Type[] { typeof(MyCodec) } |
| }); |
| </code></pre><div class="NOTE"><h5>Note</h5><p><a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> also registers all built-in codec types automatically.</p> |
| </div> |
| <h2 id="custom-postings-formats">Custom Postings Formats</h2> |
| <p>If you just want to customize the <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>, or use different postings formats for different fields.</p> |
| <pre><code class="lang-cs">[PostingsFormatName("MyPostingsFormat")] |
| public class MyPostingsFormat : PostingsFormat |
| { |
| private readonly string field; |
| |
| public MyPostingsFormat(string field) |
| { |
| this.field = field ?? throw new ArgumentNullException(nameof(field)); |
| } |
| |
| public override FieldsConsumer FieldsConsumer(SegmentWriteState state) |
| { |
| // Returns fields consumer... |
| } |
| |
| public override FieldsProducer FieldsProducer(SegmentReadState state) |
| { |
| // Returns fields producer... |
| } |
| } |
| </code></pre><p>Extend the the default <a class="xref" href="Lucene.Net.Codecs.Lucene46.Lucene46Codec.html">Lucene46Codec</a>, and override <a class="xref" href="Lucene.Net.Codecs.Lucene46.Lucene46Codec.html">GetPostingsFormatForField(string)</a> to return your custom postings format.</p> |
| <pre><code class="lang-cs">[CodecName("MyCodec")] |
| public class MyCodec : Lucene46Codec |
| { |
| public override PostingsFormat GetPostingsFormatForField(string field) |
| { |
| return new MyPostingsFormat(field); |
| } |
| } |
| </code></pre><p>Registration of a custom postings format is similar to registering custom codecs, implement <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a> and then call <xref:Lucene.Net.Codecs.PostingsFormat.SetPostingsFormatFactory> at application start up.</p> |
| <pre><code class="lang-cs">PostingsFormat.SetPostingsFormatFactory(new DefaultPostingsFormatFactory { |
| CustomPostingsFormatTypes = new Type[] { typeof(MyPostingsFormat) } |
| }); |
| </code></pre><h2 id="custom-docvalues-formats">Custom DocValues Formats</h2> |
| <p>Similarly, if you just want to customize the <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> per-field, have a look at <a class="xref" href="Lucene.Net.Codecs.Lucene46.Lucene46Codec.html">GetDocValuesFormatForField(string)</a>. Custom implementations can be provided by implementing <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a> and registering the factory using <xref:Lucene.Net.Codecs.DocValuesFormat.SetDocValuesFormatFactory>.</p> |
| <h2 id="testing-custom-codecs">Testing Custom Codecs</h2> |
| <p>The <xref:Lucene.Net.TestFramework> library contains specialized classes to minimize the amount of code required to thoroughly test extensions to Lucene.NET. Create a new class library project targeting an executable framework your consumers will be using and add the following NuGet package reference. The test framework uses NUnit as the test runner.</p> |
| <div class="NOTE"><h5>Note</h5><p>See <a href="https://docs.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-nunit">Unit testing C# with NUnit and .NET Core</a> for detailed instructions on how to set up a class library to use with NUnit.</p> |
| </div> |
| <div class="NOTE"><h5>Note</h5><p>.NET Standard is not an executable target. Tests will not run unless you target a framework such as <code>netcoreapp3.1</code> or <code>net48</code>.</p> |
| </div> |
| <p>Here is an example project file for .NET Core 3.1 for testing a project named <code>MyCodecs.csproj</code>.</p> |
| <pre><code class="lang-xml"><Project Sdk="Microsoft.NET.Sdk"> |
| |
| <PropertyGroup> |
| <TargetFramework>netcoreapp3.1</TargetFramework> |
| </PropertyGroup> |
| |
| <ItemGroup> |
| <PackageReference Include="nunit" Version="3.9.0" /> |
| <PackageReference Include="NUnit3TestAdapter" Version="3.16.0" /> |
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> |
| <PackageReference Include="Lucene.Net.TestFramework" Version="4.8.0-beta00008" /> |
| <PackageReference Include="System.Net.Primitives" Version="4.3.0"/> |
| </ItemGroup> |
| |
| <ItemGroup> |
| <ProjectReference Include="..\MyCodecs\MyCodecs.csproj" /> |
| </ItemGroup> |
| |
| </Project> |
| </code></pre><div class="NOTE"><h5>Note</h5><p>This example outlines testing a custom <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>, but testing other codec dependencies is a similar procedure.</p> |
| </div> |
| <p>To extend an existing codec with a new <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>, the <a class="xref" href="Lucene.Net.Codecs.FilterCodec.html">FilterCodec</a> class can be subclassed and the codec to be extended supplied to the <a class="xref" href="Lucene.Net.Codecs.FilterCodec.html">FilterCodec</a> constructor. A <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> should be supplied to an existing codec to run the tests against it.</p> |
| <p>This example is for testing a custom postings format named <code>MyPostingsFormat</code>. Creating a postings format is a bit involved, but an overview of the process is in <a href="http://blog.mikemccandless.com/2012/07/building-new-lucene-postings-format.html">Building a new Lucene postings format </a>.</p> |
| <pre><code class="lang-cs">public class MyCodec : FilterCodec |
| { |
| private readonly PostingsFormat myPostingsFormat; |
| |
| public MyCodec() |
| : base(new Lucene.Net.Codecs.Lucene46.Lucene46Codec()) |
| { |
| myPostingsFormat = new MyPostingsFormat(); |
| } |
| } |
| </code></pre><p>Next, add a class to the test project and decorate it with the <code>TestFixtureAttribute</code> from NUnit. To test a postings format, subclass <xref:Lucene.Net.Index.BasePostingsFormatTestCase>, override the <code>GetCodec()</code> method, and return the codec under test. The codec can be cached in a member variable to improve the performance of the tests.</p> |
| <pre><code class="lang-cs">namespace ExampleLuceneNetTestFramework |
| { |
| [TestFixture] |
| public class TestMyPostingsFormat : BasePostingsFormatTestCase |
| { |
| private readonly Codec codec = new MyCodec(); |
| |
| protected override Codec GetCodec() |
| { |
| return codec; |
| } |
| } |
| } |
| </code></pre><p>The <xref:Lucene.Net.Index.BasePostingsFormatTestCase> class includes a barrage of 8 tests that can now be run using your favorite test runner, such as Visual Studio Test Explorer. </p> |
| <ul> |
| <li>TestDocsAndFreqs</li> |
| <li>TestDocsAndFreqsAndPositions</li> |
| <li>TestDocsAndFreqsAndPositionsAndOffsets</li> |
| <li>TestDocsAndFreqsAndPositionsAndOffsetsAndPayloads</li> |
| <li>TestDocsAndFreqsAndPositionsAndPayloads</li> |
| <li>TestDocsOnly</li> |
| <li>TestMergeStability</li> |
| <li>TestRandom</li> |
| </ul> |
| <p>The goal of the <xref:Lucene.Net.Index.BasePostingsFormatTestCase> is that if all of these tests pass, then the <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> will always be compatible with Lucene.NET.</p> |
| <h2 id="registering-codecs-with-the-test-framework">Registering Codecs with the Test Framework</h2> |
| <p>Codecs, postings formats and doc values formats can be injected into the test framework to integration test them against other Lucene.NET components. This is an advanced scenario that assumes integration tests for Lucene.NET components exist in your test project.</p> |
| <p>In your test project, add a new file to the root of the project named <code>Startup.cs</code>. Remove any namespaces from the<br>file, but leave the <code>Startup</code> class and inherit <xref:Lucene.Net.Util.LuceneTestFrameworkInitializer>.</p> |
| <pre><code class="lang-cs">public class Startup : LuceneTestFrameworkInitializer |
| { |
| /// <summary> |
| /// Runs before all tests in the current assembly |
| /// </summary> |
| protected override void TestFrameworkSetUp() |
| { |
| CodecFactory = new TestCodecFactory { |
| CustomCodecTypes = new Codec[] { typeof(MyCodec) } |
| }; |
| } |
| } |
| </code></pre><h2 id="setting-the-default-codec-for-use-in-tests">Setting the Default Codec for use in Tests</h2> |
| <p>The above block will register a new codec named <code>MyCodec</code> with the test framework. However, the test framework will not select the codec for use in tests on its own. To override the default behavior of selecting a random codec, the configuration parameter <code>tests:codec</code> must be set explicitly.</p> |
| <div class="NOTE"><h5>Note</h5><p>A codec name is derived from either the name of the class (minus the "Codec" suffix) or the <xref:Lucene.Net.Codecs.CodecName.Name> property.</p> |
| </div> |
| <h4 id="setting-the-default-codec-using-an-environment-variable">Setting the Default Codec using an Environment Variable</h4> |
| <p>Set an environment variable named <code>lucene:tests:codec</code> to the name of the codec.</p> |
| <pre><code>$env:lucene:tests:codec = "MyCodec"; # Powershell example |
| </code></pre><h4 id="setting-the-default-codec-using-a-configuration-file">Setting the Default Codec using a Configuration File</h4> |
| <p>Add a file to the test project (or a parent directory of the test project) named <code>lucene.testsettings.json</code> with a value named <code>tests:codec</code>.</p> |
| <pre><code class="lang-json">{ |
| "tests": { |
| "codec": "MyCodec" |
| } |
| } |
| </code></pre><h2 id="setting-the-default-postings-format-or-doc-values-format-for-use-in-tests">Setting the Default Postings Format or Doc Values Format for use in Tests</h2> |
| <p>Similarly to codecs, the default postings format or doc values format can be set via environment variable or configuration file.</p> |
| <h4 id="environment-variables">Environment Variables</h4> |
| <p>Set environment variables named <code>lucene:tests:postingsformat</code> to the name of the postings format and/or <code>lucene:tests:docvaluesformat</code> to the name of the doc values format.</p> |
| <pre><code>$env:lucene:tests:postingsformat = "MyPostingsFormat"; # Powershell example |
| $env:lucene:tests:docvaluesformat = "MyDocValuesFormat"; # Powershell example |
| </code></pre><h4 id="configuration-file">Configuration File</h4> |
| <p>Add a file to the test project (or a parent directory of the test project) named <code>lucene.testsettings.json</code> with a value named <code>tests:postingsformat</code> and/or <code>tests:docvaluesformat</code>.</p> |
| <pre><code class="lang-json">{ |
| "tests": { |
| "postingsformat": "MyPostingsFormat", |
| "docvaluesformat": "MyDocValuesFormat" |
| } |
| } |
| </code></pre><h2 id="default-codec-configuration">Default Codec Configuration</h2> |
| <p>For reference, the default configuration of codecs, postings formats, and doc values are as follows.</p> |
| <h4 id="codecs">Codecs</h4> |
| <p>These are the types registered by the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> by default.</p> |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Type</th> |
| <th>Assembly</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code>Lucene46</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene46.Lucene46Codec.html">Lucene46Codec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene3x</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene3x.Lucene3xCodec.html">Lucene3xCodec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene45</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45Codec.html">Lucene45Codec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene42</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42Codec.html">Lucene42Codec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene41</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41Codec.html">Lucene41Codec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene40</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40Codec.html">Lucene40Codec</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Appending</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Appending.AppendingCodec.html">AppendingCodec</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>SimpleText</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.SimpleText.SimpleTextCodec.html">SimpleTextCodec</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="NOTE"><h5>Note</h5><p>The codecs in Lucene.Net.Codecs.dll are only loaded if referenced in the calling project.</p> |
| </div> |
| <h4 id="postings-formats">Postings Formats</h4> |
| <p>These are the types registered by the <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a> by default.</p> |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Type</th> |
| <th>Assembly</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code>Lucene41</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene41.Lucene41PostingsFormat.html">Lucene41PostingsFormat</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene40</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40PostingsFormat.html">Lucene40PostingsFormat</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>SimpleText</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.SimpleText.SimpleTextPostingsFormat.html">SimpleTextPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Pulsing41</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Pulsing.Pulsing41PostingsFormat.html">Pulsing41PostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Direct</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.DirectPostingsFormat.html">DirectPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>FSTOrd41</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.FSTOrdPostingsFormat.html">FSTOrdPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>FSTOrdPulsing41</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.FSTOrdPulsing41PostingsFormat.html">FSTOrdPulsing41PostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>FST41</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.FSTPostingsFormat.html">FSTPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>FSTPulsing41</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.FSTPulsing41PostingsFormat.html">FSTPulsing41PostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Memory</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.MemoryPostingsFormat.html">MemoryPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>BloomFilter</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Bloom.BloomFilteringPostingsFormat.html">BloomFilteringPostingsFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="NOTE"><h5>Note</h5><p>The postings formats in Lucene.Net.Codecs.dll are only loaded if referenced in the calling project.</p> |
| </div> |
| <h4 id="doc-values-formats">Doc Values Formats</h4> |
| <p>These are the types registered by the <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a> by default.</p> |
| <table> |
| <thead> |
| <tr> |
| <th>Name</th> |
| <th>Type</th> |
| <th>Assembly</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code>Lucene45</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene45.Lucene45DocValuesFormat.html">Lucene45DocValuesFormat</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene42</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene42.Lucene42DocValuesFormat.html">Lucene42DocValuesFormat</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>Lucene40</code></td> |
| <td><a class="xref" href="Lucene.Net.Codecs.Lucene40.Lucene40DocValuesFormat.html">Lucene40DocValuesFormat</a></td> |
| <td>Lucene.Net.dll</td> |
| </tr> |
| <tr> |
| <td><code>SimpleText</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.SimpleText.SimpleTextDocValuesFormat.html">SimpleTextDocValuesFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Direct</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.DirectDocValuesFormat.html">DirectDocValuesFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Memory</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.Memory.MemoryDocValuesFormat.html">MemoryDocValuesFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| <tr> |
| <td><code>Disk</code></td> |
| <td><a class="xref" href="http://localhost:8080/api/codecs/Lucene.Net.Codecs.DiskDV.DiskDocValuesFormat.html">DiskDocValuesFormat</a></td> |
| <td>Lucene.Net.Codecs.dll</td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="NOTE"><h5>Note</h5><p>The doc values formats in Lucene.Net.Codecs.dll are only loaded if referenced in the calling project.</p> |
| </div> |
| </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.Codecs.BlockTermState.html">BlockTermState</a></h4> |
| <section><p>Holds all state required for <a class="xref" href="Lucene.Net.Codecs.PostingsReaderBase.html">PostingsReaderBase</a> |
| to produce a <a class="xref" href="Lucene.Net.Index.DocsEnum.html">DocsEnum</a> without re-seeking the |
| terms dict.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsReader.html">BlockTreeTermsReader</a></h4> |
| <section><p>A block-based terms index and dictionary that assigns |
| terms to variable length blocks according to how they |
| share prefixes. The terms index is a prefix trie |
| whose leaves are term blocks. The advantage of this |
| approach is that SeekExact() is often able to |
| determine a term cannot exist without doing any IO, and |
| intersection with Automata is very fast. Note that this |
| terms dictionary has it's own fixed terms index (ie, it |
| does not support a pluggable terms index |
| implementation).</p> |
| <p><strong>NOTE</strong>: this terms dictionary does not support |
| index divisor when opening an IndexReader. Instead, you |
| can change the min/maxItemsPerBlock during indexing.</p> |
| |
| <p>The data structure used by this implementation is very |
| similar to a burst trie |
| (<a href="http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.3499">http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.18.3499</a>), |
| but with added logic to break up too-large blocks of all |
| terms sharing a given prefix into smaller ones.</p> |
| |
| <p>Use <a class="xref" href="Lucene.Net.Index.CheckIndex.html">CheckIndex</a> with the <code>-verbose</code> |
| option to see summary statistics on the blocks in the |
| dictionary.</p> |
| |
| <p>See <a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsWriter.html">BlockTreeTermsWriter</a>. |
| <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.Codecs.BlockTreeTermsReader.FieldReader.html">BlockTreeTermsReader.FieldReader</a></h4> |
| <section><p>BlockTree's implementation of <a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsReader.html#Lucene_Net_Codecs_BlockTreeTermsReader_GetTerms_System_String_">GetTerms(String)</a>. </p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsReader.Stats.html">BlockTreeTermsReader.Stats</a></h4> |
| <section><p>BlockTree statistics for a single field |
| returned by <a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsReader.FieldReader.html#Lucene_Net_Codecs_BlockTreeTermsReader_FieldReader_ComputeStats">ComputeStats()</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsWriter.html">BlockTreeTermsWriter</a></h4> |
| <section><p>Block-based terms index and dictionary writer. |
| <p> |
| Writes terms dict and index, block-encoding (column |
| stride) each term's metadata for each set of terms |
| between two index terms. |
| <p> |
| Files: |
| <ul><li>.tim:<a href="#Termdictionary">Term Dictionary</a></li><li>.tip:<a href="#Termindex">Term Index</a></li></ul> |
| <p> |
| <a name="Termdictionary" id="Termdictionary"></a> |
| <h3>Term Dictionary</h3></p> |
| <p>The .tim file contains the list of terms in each |
| field along with per-term statistics (such as docfreq) |
| and per-term metadata (typically pointers to the postings list |
| for that term in the inverted index). |
| </p> |
| |
| <p>The .tim is arranged in blocks: with blocks containing |
| a variable number of entries (by default 25-48), where |
| each entry is either a term or a reference to a |
| sub-block.</p> |
| |
| <p>NOTE: The term dictionary can plug into different postings implementations: |
| the postings writer/reader are actually responsible for encoding |
| and decoding the Postings Metadata and Term Metadata sections.</p> |
| |
| <p><ul><li>TermsDict (.tim) --> Header, <em>PostingsHeader</em>, NodeBlock<sup>NumBlocks</sup>, |
| FieldSummary, DirOffset, Footer</li><li>NodeBlock --> (OuterNode | InnerNode)</li><li>OuterNode --> EntryCount, SuffixLength, Byte<sup>SuffixLength</sup>, StatsLength, < TermStats ><sup>EntryCount</sup>, MetaLength, <<em>TermMetadata</em>><sup>EntryCount</sup></li><li>InnerNode --> EntryCount, SuffixLength[,Sub?], Byte<sup>SuffixLength</sup>, StatsLength, < TermStats ? ><sup>EntryCount</sup>, MetaLength, <<em>TermMetadata ? </em>><sup>EntryCount</sup></li><li>TermStats --> DocFreq, TotalTermFreq </li><li>FieldSummary --> NumFields, <FieldNumber, NumTerms, RootCodeLength, Byte<sup>RootCodeLength</sup>, |
| SumTotalTermFreq?, SumDocFreq, DocCount><sup>NumFields</sup></li><li>Header --> CodecHeader (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a></li><li>DirOffset --> Uint64 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt64_System_Int64_">WriteInt64(Int64)</a>)</li><li>EntryCount,SuffixLength,StatsLength,DocFreq,MetaLength,NumFields, |
| FieldNumber,RootCodeLength,DocCount --> VInt (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt32_System_Int32_">WriteVInt32(Int32)</a>_</li><li>TotalTermFreq,NumTerms,SumTotalTermFreq,SumDocFreq --> |
| VLong (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt64_System_Int64_">WriteVInt64(Int64)</a>)</li><li>Footer --> CodecFooter (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a>)</li></ul> |
| <p>Notes:</p> |
| <ul><li>Header is a CodecHeader (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a>) storing the version information |
| for the BlockTree implementation.</li><li>DirOffset is a pointer to the FieldSummary section.</li><li>DocFreq is the count of documents which contain the term.</li><li>TotalTermFreq is the total number of occurrences of the term. this is encoded |
| as the difference between the total number of occurrences and the DocFreq.</li><li>FieldNumber is the fields number from <span class="xref">Lucene.Net.Codecs.BlockTreeTermsWriter.fieldInfos</span>. (.fnm)</li><li>NumTerms is the number of unique terms for the field.</li><li>RootCode points to the root block for the field.</li><li>SumDocFreq is the total number of postings, the number of term-document pairs across |
| the entire field.</li><li>DocCount is the number of documents that have at least one posting for this field.</li><li>PostingsHeader and TermMetadata are plugged into by the specific postings implementation: |
| these contain arbitrary per-file data (such as parameters or versioning information) |
| and per-term data (such as pointers to inverted files).</li><li>For inner nodes of the tree, every entry will steal one bit to mark whether it points |
| to child nodes(sub-block). If so, the corresponding <a class="xref" href="Lucene.Net.Codecs.TermStats.html">TermStats</a> and TermMetadata are omitted </li></ul> |
| <a name="Termindex" id="Termindex"></a> |
| <h3>Term Index</h3> |
| <p>The .tip file contains an index into the term dictionary, so that it can be |
| accessed randomly. The index is also used to determine |
| when a given term cannot exist on disk (in the .tim file), saving a disk seek.</p> |
| <ul><li>TermsIndex (.tip) --> Header, FSTIndex<sup>NumFields</sup> |
| <IndexStartFP><sup>NumFields</sup>, DirOffset, Footer</li><li>Header --> CodecHeader (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteHeader_Lucene_Net_Store_DataOutput_System_String_System_Int32_">WriteHeader(DataOutput, String, Int32)</a>)</li><li>DirOffset --> Uint64 (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteInt64_System_Int64_">WriteInt64(Int64)</a></li><li>IndexStartFP --> VLong (<a class="xref" href="Lucene.Net.Store.DataOutput.html#Lucene_Net_Store_DataOutput_WriteVInt64_System_Int64_">WriteVInt64(Int64)</a></li><li>FSTIndex --> <span class="xref">FST{byte[]}</span></li><li>Footer --> CodecFooter (<a class="xref" href="Lucene.Net.Codecs.CodecUtil.html#Lucene_Net_Codecs_CodecUtil_WriteFooter_Lucene_Net_Store_IndexOutput_">WriteFooter(IndexOutput)</a></li></ul> |
| <p>Notes:</p> |
| <ul><li>The .tip file contains a separate FST for each |
| field. The FST maps a term prefix to the on-disk |
| block that holds all terms starting with that |
| prefix. Each field's IndexStartFP points to its |
| FST.</li><li>DirOffset is a pointer to the start of the IndexStartFPs |
| for all fields</li><li>It's possible that an on-disk block would contain |
| too many terms (more than the allowed maximum |
| (default: 48)). When this happens, the block is |
| sub-divided into new blocks (called "floor |
| blocks"), and then the output in the FST for the |
| block's prefix encodes the leading byte of each |
| sub-block, and its file pointer.</li></ul> |
| <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.Codecs.Codec.html">Codec</a></h4> |
| <section><p>Encodes/decodes an inverted index segment. |
| <p> |
| Note, when extending this class, the name (<a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_Name">Name</a>) is |
| written into the index. In order for the segment to be read, the |
| name must resolve to your implementation via <a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_ForName_System_String_">ForName(String)</a>. |
| This method uses <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html#Lucene_Net_Codecs_ICodecFactory_GetCodec_System_String_">GetCodec(String)</a> to resolve codec names. |
| <p> |
| To implement your own codec: |
| <ol><li>Subclass this class.</li><li>Subclass <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a>, override the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_Initialize">Initialize()</a> method, |
| and add the line <code>base.ScanForCodecs(typeof(YourCodec).Assembly)</code>. |
| If you have any codec classes in your assembly |
| that are not meant for reading, you can add the <a class="xref" href="Lucene.Net.Codecs.ExcludeCodecFromScanAttribute.html">ExcludeCodecFromScanAttribute</a> |
| to them so they are ignored by the scan.</li><li>set the new <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a> by calling <a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_SetCodecFactory_Lucene_Net_Codecs_ICodecFactory_">SetCodecFactory(ICodecFactory)</a> at application startup.</li></ol> |
| If your codec has dependencies, you may also override <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_GetCodec_System_Type_">GetCodec(Type)</a> to inject |
| them via pure DI or a DI container. See <a href="http://blog.ploeh.dk/2014/05/19/di-friendly-framework/">DI-Friendly Framework</a> |
| to understand the approach used. |
| <p> |
| <strong>Codec Names</strong> |
| <p> |
| Unlike the Java version, codec names are by default convention-based on the class name. |
| If you name your custom codec class "MyCustomCodec", the codec name will the same name |
| without the "Codec" suffix: "MyCustom". |
| <p> |
| You can override this default behavior by using the <a class="xref" href="Lucene.Net.Codecs.CodecNameAttribute.html">CodecNameAttribute</a> to |
| name the codec differently than this convention. Codec names must be all ASCII alphanumeric, |
| and less than 128 characters in length.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.CodecNameAttribute.html">CodecNameAttribute</a></h4> |
| <section><p>Represents an attribute that is used to name a <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>, if a name |
| other than the default <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> naming convention is desired.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.CodecUtil.html">CodecUtil</a></h4> |
| <section><p>Utility class for reading and writing versioned headers. |
| <p> |
| Writing codec headers is useful to ensure that a file is in |
| the format you think it is. |
| <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.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a></h4> |
| <section><p>Implements the default functionality of <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a>. |
| <p> |
| To replace the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> instance, call |
| <a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_SetCodecFactory_Lucene_Net_Codecs_ICodecFactory_">SetCodecFactory(ICodecFactory)</a> at application start up. |
| <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> can be subclassed or passed additional parameters to register |
| additional codecs, inject dependencies, or change caching behavior, as shown in the following examples. |
| Alternatively, <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a> can be implemented to provide complete control over |
| codec creation and lifetimes. |
| <p> |
| <h4>Register Additional Codecs</h4> |
| <p> |
| Additional codecs can be added by initializing the instance of <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> and |
| passing an array of <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>-derived types.</p> |
| <pre><code>// Register the factory at application start up. |
| Codec.SetCodecFactory(new DefaultCodecFactory { |
| CustomCodecTypes = new Type[] { typeof(MyCodec), typeof(AnotherCodec) } |
| });</code></pre> |
| <p><p> |
| <h4>Only Use Explicitly Defined Codecs</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_PutCodecType_System_Type_">PutCodecType(Type)</a> can be used to explicitly add codec types. In this example, |
| the call to <code>base.Initialize()</code> is excluded to skip the built-in codec registration. |
| Since <code>AnotherCodec</code> doesn't have a default constructor, the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_NewCodec_System_Type_">NewCodec(Type)</a> |
| method is overridden to supply the required parameters.</p> |
| <pre><code>public class ExplicitCodecFactory : DefaultCodecFactory |
| { |
| protected override void Initialize() |
| { |
| // Load specific codecs in a specific order. |
| PutCodecType(typeof(MyCodec)); |
| PutCodecType(typeof(AnotherCodec)); |
| } |
| |
| protected override Codec NewCodec(Type type) |
| { |
| // Special case: AnotherCodec has a required dependency |
| if (typeof(AnotherCodec).Equals(type)) |
| return new AnotherCodec(new SomeDependency()); |
| |
| return base.NewCodec(type); |
| } |
| } |
| |
| // Register the factory at application start up. |
| Codec.SetCodecFactory(new ExplicitCodecFactory());</code></pre> |
| <p>See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for more examples of how to |
| inject dependencies into <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> subclasses. |
| <p> |
| <h4>Use Reflection to Scan an Assembly for Codecs</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_ScanForCodecs_System_Reflection_Assembly_">ScanForCodecs(Assembly)</a> or <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_ScanForCodecs_System_Collections_Generic_IEnumerable_System_Reflection_Assembly__">ScanForCodecs(IEnumerable<Assembly>)</a> can be used |
| to scan assemblies using .NET Reflection for codec types and add all subclasses that are found automatically. |
| This example calls <code>base.Initialize()</code> to load the default codecs prior to scanning for additional codecs.</p> |
| <pre><code>public class ScanningCodecFactory : DefaultCodecFactory |
| { |
| protected override void Initialize() |
| { |
| // Load all default codecs |
| base.Initialize(); |
| |
| // Load all of the codecs inside of the same assembly that MyCodec is defined in |
| ScanForCodecs(typeof(MyCodec).Assembly); |
| } |
| } |
| |
| // Register the factory at application start up. |
| Codec.SetCodecFactory(new ScanningCodecFactory());</code></pre> |
| <p>Codecs in the target assemblie(s) can be excluded from the scan by decorating them with |
| the <a class="xref" href="Lucene.Net.Codecs.ExcludeCodecFromScanAttribute.html">ExcludeCodecFromScanAttribute</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a></h4> |
| <section><p>Implements the default functionality of <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a>. |
| <p> |
| To replace the <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a> instance, call |
| <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_SetDocValuesFormatFactory_Lucene_Net_Codecs_IDocValuesFormatFactory_">SetDocValuesFormatFactory(IDocValuesFormatFactory)</a> at application start up. |
| <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a> can be subclassed or passed additional parameters to register |
| additional codecs, inject dependencies, or change caching behavior, as shown in the following examples. |
| Alternatively, <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a> can be implemented to provide complete control over |
| doc values format creation and lifetimes. |
| <p> |
| <h4>Register Additional DocValuesFormats</h4> |
| <p> |
| Additional codecs can be added by initializing the instance of <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a> and |
| passing an array of <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a>-derived types.</p> |
| <pre><code>// Register the factory at application start up. |
| DocValuesFormat.SetDocValuesFormatFactory(new DefaultDocValuesFormatFactory { |
| CustomDocValuesFormatTypes = new Type[] { typeof(MyDocValuesFormat), typeof(AnotherDocValuesFormat) } |
| });</code></pre> |
| <p><p> |
| <h4>Only Use Explicitly Defined DocValuesFormats</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_PutDocValuesFormatType_System_Type_">PutDocValuesFormatType(Type)</a> can be used to explicitly add codec types. In this example, |
| the call to <code>base.Initialize()</code> is excluded to skip the built-in codec registration. |
| Since <code>AnotherDocValuesFormat</code> doesn't have a default constructor, the <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_NewDocValuesFormat_System_Type_">NewDocValuesFormat(Type)</a> |
| method is overridden to supply the required parameters.</p> |
| <pre><code>public class ExplicitDocValuesFormatFactory : DefaultDocValuesFormatFactory |
| { |
| protected override void Initialize() |
| { |
| // Load specific codecs in a specific order. |
| PutDocValuesFormatType(typeof(MyDocValuesFormat)); |
| PutDocValuesFormatType(typeof(AnotherDocValuesFormat)); |
| } |
| |
| protected override DocValuesFormat NewDocValuesFormat(Type type) |
| { |
| // Special case: AnotherDocValuesFormat has a required dependency |
| if (typeof(AnotherDocValuesFormat).Equals(type)) |
| return new AnotherDocValuesFormat(new SomeDependency()); |
| |
| return base.NewDocValuesFormat(type); |
| } |
| } |
| |
| // Register the factory at application start up. |
| DocValuesFormat.SetDocValuesFormatFactory(new ExplicitDocValuesFormatFactory());</code></pre> |
| <p>See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for more examples of how to |
| inject dependencies into <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> subclasses. |
| <p> |
| <h4>Use Reflection to Scan an Assembly for DocValuesFormats</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_ScanForDocValuesFormats_System_Reflection_Assembly_">ScanForDocValuesFormats(Assembly)</a> or <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_ScanForDocValuesFormats_System_Collections_Generic_IEnumerable_System_Reflection_Assembly__">ScanForDocValuesFormats(IEnumerable<Assembly>)</a> can be used |
| to scan assemblies using .NET Reflection for codec types and add all subclasses that are found automatically.</p> |
| <pre><code>public class ScanningDocValuesFormatFactory : DefaultDocValuesFormatFactory |
| { |
| protected override void Initialize() |
| { |
| // Load all default codecs |
| base.Initialize(); |
| |
| // Load all of the codecs inside of the same assembly that MyDocValuesFormat is defined in |
| ScanForDocValuesFormats(typeof(MyDocValuesFormat).Assembly); |
| } |
| } |
| |
| // Register the factory at application start up. |
| DocValuesFormat.SetDocValuesFormatFactory(new ScanningDocValuesFormatFactory());</code></pre> |
| <p>Doc values formats in the target assembly can be excluded from the scan by decorating them with |
| the <a class="xref" href="Lucene.Net.Codecs.ExcludeDocValuesFormatFromScanAttribute.html">ExcludeDocValuesFormatFromScanAttribute</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a></h4> |
| <section><p>Implements the default functionality of <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a>. |
| <p> |
| To replace the <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a> instance, call |
| <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_SetPostingsFormatFactory_Lucene_Net_Codecs_IPostingsFormatFactory_">SetPostingsFormatFactory(IPostingsFormatFactory)</a> at application start up. |
| <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a> can be subclassed or passed additional parameters to register |
| additional codecs, inject dependencies, or change caching behavior, as shown in the following examples. |
| Alternatively, <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a> can be implemented to provide complete control over |
| postings format creation and lifetimes. |
| <p> |
| <h4>Register Additional PostingsFormats</h4> |
| <p> |
| Additional codecs can be added by initializing the instance of <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a> and |
| passing an array of <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>-derived types.</p> |
| <pre><code>// Register the factory at application start up. |
| PostingsFormat.SetPostingsFormatFactory(new DefaultPostingsFormatFactory { |
| CustomPostingsFormatTypes = new Type[] { typeof(MyPostingsFormat), typeof(AnotherPostingsFormat) } |
| });</code></pre> |
| <p><p> |
| <h4>Only Use Explicitly Defined PostingsFormats</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_PutPostingsFormatType_System_Type_">PutPostingsFormatType(Type)</a> can be used to explicitly add codec types. In this example, |
| the call to <code>base.Initialize()</code> is excluded to skip the built-in codec registration. |
| Since <code>AnotherPostingsFormat</code> doesn't have a default constructor, the <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_NewPostingsFormat_System_Type_">NewPostingsFormat(Type)</a> |
| method is overridden to supply the required parameters.</p> |
| <pre><code>public class ExplicitPostingsFormatFactory : DefaultPostingsFormatFactory |
| { |
| protected override void Initialize() |
| { |
| // Load specific codecs in a specific order. |
| PutPostingsFormatType(typeof(MyPostingsFormat)); |
| PutPostingsFormatType(typeof(AnotherPostingsFormat)); |
| } |
| |
| protected override PostingsFormat NewPostingsFormat(Type type) |
| { |
| // Special case: AnotherPostingsFormat has a required dependency |
| if (typeof(AnotherPostingsFormat).Equals(type)) |
| return new AnotherPostingsFormat(new SomeDependency()); |
| |
| return base.NewPostingsFormat(type); |
| } |
| } |
| |
| // Register the factory at application start up. |
| PostingsFormat.SetPostingsFormatFactory(new ExplicitPostingsFormatFactory());</code></pre> |
| <p>See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for more examples of how to |
| inject dependencies into <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> subclasses. |
| <p> |
| <h4>Use Reflection to Scan an Assembly for PostingsFormats</h4> |
| <p> |
| <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_ScanForPostingsFormats_System_Reflection_Assembly_">ScanForPostingsFormats(Assembly)</a> or <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_ScanForPostingsFormats_System_Collections_Generic_IEnumerable_System_Reflection_Assembly__">ScanForPostingsFormats(IEnumerable<Assembly>)</a> can be used |
| to scan assemblies using .NET Reflection for codec types and add all subclasses that are found automatically.</p> |
| <pre><code>public class ScanningPostingsFormatFactory : DefaultPostingsFormatFactory |
| { |
| protected override void Initialize() |
| { |
| // Load all default codecs |
| base.Initialize(); |
| |
| // Load all of the codecs inside of the same assembly that MyPostingsFormat is defined in |
| ScanForPostingsFormats(typeof(MyPostingsFormat).Assembly); |
| } |
| } |
| |
| // Register the factory at application start up. |
| PostingsFormat.SetPostingsFormatFactory(new ScanningPostingsFormatFactory());</code></pre> |
| <p>Postings formats in the target assembly can be excluded from the scan by decorating them with |
| the <a class="xref" href="Lucene.Net.Codecs.ExcludePostingsFormatFromScanAttribute.html">ExcludePostingsFormatFromScanAttribute</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.DocValuesConsumer.html">DocValuesConsumer</a></h4> |
| <section><p>Abstract API that consumes numeric, binary and |
| sorted docvalues. Concrete implementations of this |
| actually do "something" with the docvalues (write it into |
| the index in a specific format). |
| <p> |
| The lifecycle is: |
| <ol><li>DocValuesConsumer is created by |
| <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_FieldsConsumer_Lucene_Net_Index_SegmentWriteState_">FieldsConsumer(SegmentWriteState)</a> or |
| <a class="xref" href="Lucene.Net.Codecs.NormsFormat.html#Lucene_Net_Codecs_NormsFormat_NormsConsumer_Lucene_Net_Index_SegmentWriteState_">NormsConsumer(SegmentWriteState)</a>.</li><li><a class="xref" href="Lucene.Net.Codecs.DocValuesConsumer.html#Lucene_Net_Codecs_DocValuesConsumer_AddNumericField_Lucene_Net_Index_FieldInfo_System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___">AddNumericField(FieldInfo, IEnumerable<Nullable<Int64>>)</a>, |
| <a class="xref" href="Lucene.Net.Codecs.DocValuesConsumer.html#Lucene_Net_Codecs_DocValuesConsumer_AddBinaryField_Lucene_Net_Index_FieldInfo_System_Collections_Generic_IEnumerable_Lucene_Net_Util_BytesRef__">AddBinaryField(FieldInfo, IEnumerable<BytesRef>)</a>, |
| or <a class="xref" href="Lucene.Net.Codecs.DocValuesConsumer.html#Lucene_Net_Codecs_DocValuesConsumer_AddSortedField_Lucene_Net_Index_FieldInfo_System_Collections_Generic_IEnumerable_Lucene_Net_Util_BytesRef__System_Collections_Generic_IEnumerable_System_Nullable_System_Int64___">AddSortedField(FieldInfo, IEnumerable<BytesRef>, IEnumerable<Nullable<Int64>>)</a> are called for each Numeric, |
| Binary, or Sorted docvalues field. The API is a "pull" rather |
| than "push", and the implementation is free to iterate over the |
| values multiple times (<span class="xref">System.Collections.Generic.IEnumerable<T>.GetEnumerator()</span>).</li><li>After all fields are added, the consumer is <a class="xref" href="Lucene.Net.Codecs.DocValuesConsumer.html#Lucene_Net_Codecs_DocValuesConsumer_Dispose">Dispose()</a>d.</li></ol> |
| <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.Codecs.DocValuesFormat.html">DocValuesFormat</a></h4> |
| <section><p>Encodes/decodes per-document values. |
| <p> |
| Note, when extending this class, the name (<a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_Name">Name</a>) may |
| written into the index in certain configurations. In order for the segment |
| to be read, the name must resolve to your implementation via <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_ForName_System_String_">ForName(String)</a>. |
| This method uses <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html#Lucene_Net_Codecs_IDocValuesFormatFactory_GetDocValuesFormat_System_String_">GetDocValuesFormat(String)</a> to resolve format names. |
| <p> |
| To implement your own format: |
| <ol><li>Subclass this class.</li><li>Subclass <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html">DefaultDocValuesFormatFactory</a>, override the <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_Initialize">Initialize()</a> method, |
| and add the line <code>base.ScanForDocValuesFormats(typeof(YourDocValuesFormat).Assembly)</code>. |
| If you have any format classes in your assembly |
| that are not meant for reading, you can add the <a class="xref" href="Lucene.Net.Codecs.ExcludeDocValuesFormatFromScanAttribute.html">ExcludeDocValuesFormatFromScanAttribute</a> |
| to them so they are ignored by the scan.</li><li>Set the new <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a> by calling <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_SetDocValuesFormatFactory_Lucene_Net_Codecs_IDocValuesFormatFactory_">SetDocValuesFormatFactory(IDocValuesFormatFactory)</a> |
| at application startup.</li></ol> |
| If your format has dependencies, you may also override <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_GetDocValuesFormat_System_Type_">GetDocValuesFormat(Type)</a> |
| to inject them via pure DI or a DI container. See <a href="http://blog.ploeh.dk/2014/05/19/di-friendly-framework/">DI-Friendly Framework</a> |
| to understand the approach used. |
| <p> |
| <strong>DocValuesFormat Names</strong> |
| <p> |
| Unlike the Java version, format names are by default convention-based on the class name. |
| If you name your custom format class "MyCustomDocValuesFormat", the format name will the same name |
| without the "DocValuesFormat" suffix: "MyCustom". |
| <p> |
| You can override this default behavior by using the <a class="xref" href="Lucene.Net.Codecs.DocValuesFormatNameAttribute.html">DocValuesFormatNameAttribute</a> to |
| name the format differently than this convention. Format names must be all ASCII alphanumeric, |
| and less than 128 characters in length. |
| <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.Codecs.DocValuesFormatNameAttribute.html">DocValuesFormatNameAttribute</a></h4> |
| <section><p>Represents an attribute that is used to name a <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a>, if a name |
| other than the default <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> naming convention is desired.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.DocValuesProducer.html">DocValuesProducer</a></h4> |
| <section><p>Abstract API that produces numeric, binary and |
| sorted docvalues. |
| <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.Codecs.ExcludeCodecFromScanAttribute.html">ExcludeCodecFromScanAttribute</a></h4> |
| <section><p>When placed on a class that subclasses <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>, adding this |
| attribute will exclude the type from consideration in the |
| <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_ScanForCodecs_System_Reflection_Assembly_">ScanForCodecs(Assembly)</a> method. |
| <p> |
| However, the <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> type can still be added manually using |
| <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html#Lucene_Net_Codecs_DefaultCodecFactory_PutCodecType_System_Type_">PutCodecType(Type)</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.ExcludeDocValuesFormatFromScanAttribute.html">ExcludeDocValuesFormatFromScanAttribute</a></h4> |
| <section><p>When placed on a class that subclasses <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a>, adding this |
| attribute will exclude the type from consideration in the |
| <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_ScanForDocValuesFormats_System_Reflection_Assembly_">ScanForDocValuesFormats(Assembly)</a> method. |
| <p> |
| However, the <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> type can still be added manually using |
| <a class="xref" href="Lucene.Net.Codecs.DefaultDocValuesFormatFactory.html#Lucene_Net_Codecs_DefaultDocValuesFormatFactory_PutDocValuesFormatType_System_Type_">PutDocValuesFormatType(Type)</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.ExcludePostingsFormatFromScanAttribute.html">ExcludePostingsFormatFromScanAttribute</a></h4> |
| <section><p>When placed on a class that subclasses <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>, adding this |
| attribute will exclude the type from consideration in the |
| <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_ScanForPostingsFormats_System_Reflection_Assembly_">ScanForPostingsFormats(Assembly)</a> method. |
| <p> |
| However, the <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> type can still be added manually using |
| <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_PutPostingsFormatType_System_Type_">PutPostingsFormatType(Type)</a>.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.FieldInfosFormat.html">FieldInfosFormat</a></h4> |
| <section><p>Encodes/decodes <a class="xref" href="Lucene.Net.Index.FieldInfos.html">FieldInfos</a>. |
| <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.Codecs.FieldInfosReader.html">FieldInfosReader</a></h4> |
| <section><p>Codec API for reading <a class="xref" href="Lucene.Net.Index.FieldInfos.html">FieldInfos</a>. |
| <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.Codecs.FieldInfosWriter.html">FieldInfosWriter</a></h4> |
| <section><p>Codec API for writing <a class="xref" href="Lucene.Net.Index.FieldInfos.html">FieldInfos</a>. |
| <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.Codecs.FieldsConsumer.html">FieldsConsumer</a></h4> |
| <section><p>Abstract API that consumes terms, doc, freq, prox, offset and |
| payloads postings. Concrete implementations of this |
| actually do "something" with the postings (write it into |
| the index in a specific format). |
| <p> |
| The lifecycle is: |
| <ol><li>FieldsConsumer is created by |
| <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_FieldsConsumer_Lucene_Net_Index_SegmentWriteState_">FieldsConsumer(SegmentWriteState)</a>.</li><li>For each field, <a class="xref" href="Lucene.Net.Codecs.FieldsConsumer.html#Lucene_Net_Codecs_FieldsConsumer_AddField_Lucene_Net_Index_FieldInfo_">AddField(FieldInfo)</a> is called, |
| returning a <a class="xref" href="Lucene.Net.Codecs.TermsConsumer.html">TermsConsumer</a> for the field.</li><li>After all fields are added, the consumer is <a class="xref" href="Lucene.Net.Codecs.FieldsConsumer.html#Lucene_Net_Codecs_FieldsConsumer_Dispose">Dispose()</a>d.</li></ol> |
| <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.Codecs.FieldsProducer.html">FieldsProducer</a></h4> |
| <section><p>Abstract API that produces terms, doc, freq, prox, offset and |
| payloads postings. |
| <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.Codecs.FilterCodec.html">FilterCodec</a></h4> |
| <section><p>A codec that forwards all its method calls to another codec. |
| <p> |
| Extend this class when you need to reuse the functionality of an existing |
| codec. For example, if you want to build a codec that redefines Lucene46's |
| <a class="xref" href="Lucene.Net.Codecs.LiveDocsFormat.html">LiveDocsFormat</a>:</p> |
| <pre><code> public sealed class CustomCodec : FilterCodec |
| { |
| public CustomCodec() |
| : base("CustomCodec", new Lucene46Codec()) |
| { |
| } |
| |
| public override LiveDocsFormat LiveDocsFormat |
| { |
| get { return new CustomLiveDocsFormat(); } |
| } |
| }</code></pre> |
| |
| <p><p> |
| <em>Please note:</em> Don't call <a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_ForName_System_String_">ForName(String)</a> from |
| the no-arg constructor of your own codec. When the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> |
| loads your own <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>, the <a class="xref" href="Lucene.Net.Codecs.DefaultCodecFactory.html">DefaultCodecFactory</a> has not yet fully initialized! |
| If you want to extend another <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a>, instantiate it directly by calling |
| its constructor. |
| <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.Codecs.LiveDocsFormat.html">LiveDocsFormat</a></h4> |
| <section><p>Format for live/deleted documents. |
| <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.Codecs.MappingMultiDocsAndPositionsEnum.html">MappingMultiDocsAndPositionsEnum</a></h4> |
| <section><p>Exposes flex API, merged from flex API of sub-segments, |
| remapping docIDs (this is used for segment merging). |
| <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.Codecs.MappingMultiDocsEnum.html">MappingMultiDocsEnum</a></h4> |
| <section><p>Exposes flex API, merged from flex API of sub-segments, |
| remapping docIDs (this is used for segment merging). |
| <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.Codecs.MultiLevelSkipListReader.html">MultiLevelSkipListReader</a></h4> |
| <section><p>This abstract class reads skip lists with multiple levels. |
| <p> |
| See <a class="xref" href="Lucene.Net.Codecs.MultiLevelSkipListWriter.html">MultiLevelSkipListWriter</a> for the information about the encoding |
| of the multi level skip lists. |
| <p> |
| Subclasses must implement the abstract method <a class="xref" href="Lucene.Net.Codecs.MultiLevelSkipListReader.html#Lucene_Net_Codecs_MultiLevelSkipListReader_ReadSkipData_System_Int32_Lucene_Net_Store_IndexInput_">ReadSkipData(Int32, IndexInput)</a> |
| which defines the actual format of the skip data. |
| <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.Codecs.MultiLevelSkipListWriter.html">MultiLevelSkipListWriter</a></h4> |
| <section><p>This abstract class writes skip lists with multiple levels.</p> |
| <pre><code>Example for skipInterval = 3: |
| c (skip level 2) |
| c c c (skip level 1) |
| x x x x x x x x x x (skip level 0) |
| d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d (posting list) |
| 3 6 9 12 15 18 21 24 27 30 (df) |
| |
| d - document |
| x - skip data |
| c - skip data with child pointer |
| |
| Skip level i contains every skipInterval-th entry from skip level i-1. |
| Therefore the number of entries on level i is: floor(df / ((skipInterval ^ (i + 1))). |
| |
| Each skip entry on a level i>0 contains a pointer to the corresponding skip entry in list i-1. |
| this guarantees a logarithmic amount of skips to find the target document. |
| |
| While this class takes care of writing the different skip levels, |
| subclasses must define the actual format of the skip data.</code></pre> |
| <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.Codecs.NormsFormat.html">NormsFormat</a></h4> |
| <section><p>Encodes/decodes per-document score normalization values.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.PostingsBaseFormat.html">PostingsBaseFormat</a></h4> |
| <section><p>Provides a <a class="xref" href="Lucene.Net.Codecs.PostingsReaderBase.html">PostingsReaderBase</a> and |
| <a class="xref" href="Lucene.Net.Codecs.PostingsWriterBase.html">PostingsWriterBase</a>. |
| <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.Codecs.PostingsConsumer.html">PostingsConsumer</a></h4> |
| <section><p>Abstract API that consumes postings for an individual term. |
| <p> |
| The lifecycle is: |
| <ol><li>PostingsConsumer is returned for each term by |
| <a class="xref" href="Lucene.Net.Codecs.TermsConsumer.html#Lucene_Net_Codecs_TermsConsumer_StartTerm_Lucene_Net_Util_BytesRef_">StartTerm(BytesRef)</a>.</li><li><a class="xref" href="Lucene.Net.Codecs.PostingsConsumer.html#Lucene_Net_Codecs_PostingsConsumer_StartDoc_System_Int32_System_Int32_">StartDoc(Int32, Int32)</a> is called for each |
| document where the term occurs, specifying id |
| and term frequency for that document.</li><li>If positions are enabled for the field, then |
| <a class="xref" href="Lucene.Net.Codecs.PostingsConsumer.html#Lucene_Net_Codecs_PostingsConsumer_AddPosition_System_Int32_Lucene_Net_Util_BytesRef_System_Int32_System_Int32_">AddPosition(Int32, BytesRef, Int32, Int32)</a> |
| will be called for each occurrence in the |
| document.</li><li><a class="xref" href="Lucene.Net.Codecs.PostingsConsumer.html#Lucene_Net_Codecs_PostingsConsumer_FinishDoc">FinishDoc()</a> is called when the producer |
| is done adding positions to the document.</li></ol> |
| <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.Codecs.PostingsFormat.html">PostingsFormat</a></h4> |
| <section><p>Encodes/decodes terms, postings, and proximity data. |
| <p> |
| Note, when extending this class, the name (<a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_Name">Name</a>) may |
| written into the index in certain configurations. In order for the segment |
| to be read, the name must resolve to your implementation via <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_ForName_System_String_">ForName(String)</a>. |
| This method uses <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html#Lucene_Net_Codecs_IPostingsFormatFactory_GetPostingsFormat_System_String_">GetPostingsFormat(String)</a> to resolve format names. |
| <p> |
| If you implement your own format: |
| <ol><li>Subclass this class.</li><li>Subclass <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html">DefaultPostingsFormatFactory</a>, override <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_Initialize">Initialize()</a>, |
| and add the line <code>base.ScanForPostingsFormats(typeof(YourPostingsFormat).Assembly)</code>. |
| If you have any format classes in your assembly |
| that are not meant for reading, you can add the <a class="xref" href="Lucene.Net.Codecs.ExcludePostingsFormatFromScanAttribute.html">ExcludePostingsFormatFromScanAttribute</a> |
| to them so they are ignored by the scan.</li><li>Set the new <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a> by calling <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_SetPostingsFormatFactory_Lucene_Net_Codecs_IPostingsFormatFactory_">SetPostingsFormatFactory(IPostingsFormatFactory)</a> |
| at application startup.</li></ol> |
| If your format has dependencies, you may also override <a class="xref" href="Lucene.Net.Codecs.DefaultPostingsFormatFactory.html#Lucene_Net_Codecs_DefaultPostingsFormatFactory_GetPostingsFormat_System_Type_">GetPostingsFormat(Type)</a> to inject |
| them via pure DI or a DI container. See <a href="http://blog.ploeh.dk/2014/05/19/di-friendly-framework/">DI-Friendly Framework</a> |
| to understand the approach used. |
| <p> |
| <strong>PostingsFormat Names</strong> |
| <p> |
| Unlike the Java version, format names are by default convention-based on the class name. |
| If you name your custom format class "MyCustomPostingsFormat", the codec name will the same name |
| without the "PostingsFormat" suffix: "MyCustom". |
| <p> |
| You can override this default behavior by using the <a class="xref" href="Lucene.Net.Codecs.PostingsFormatNameAttribute.html">PostingsFormatNameAttribute</a> to |
| name the format differently than this convention. Format names must be all ASCII alphanumeric, |
| and less than 128 characters in length. |
| <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.Codecs.PostingsFormatNameAttribute.html">PostingsFormatNameAttribute</a></h4> |
| <section><p>Represents an attribute that is used to name a <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a>, if a name |
| other than the default <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> naming convention is desired.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.PostingsReaderBase.html">PostingsReaderBase</a></h4> |
| <section><p>The core terms dictionaries (BlockTermsReader, |
| <a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsReader.html">BlockTreeTermsReader</a>) interact with a single instance |
| of this class to manage creation of <a class="xref" href="Lucene.Net.Index.DocsEnum.html">DocsEnum</a> and |
| <a class="xref" href="Lucene.Net.Index.DocsAndPositionsEnum.html">DocsAndPositionsEnum</a> instances. It provides an |
| <a class="xref" href="Lucene.Net.Store.IndexInput.html">IndexInput</a> (termsIn) where this class may read any |
| previously stored data that it had written in its |
| corresponding <a class="xref" href="Lucene.Net.Codecs.PostingsWriterBase.html">PostingsWriterBase</a> at indexing |
| time. |
| <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.Codecs.PostingsWriterBase.html">PostingsWriterBase</a></h4> |
| <section><p>Extension of <a class="xref" href="Lucene.Net.Codecs.PostingsConsumer.html">PostingsConsumer</a> to support pluggable term dictionaries. |
| <p> |
| This class contains additional hooks to interact with the provided |
| term dictionaries such as <a class="xref" href="Lucene.Net.Codecs.BlockTreeTermsWriter.html">BlockTreeTermsWriter</a>. If you want |
| to re-use an existing implementation and are only interested in |
| customizing the format of the postings list, extend this class |
| instead. |
| <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.Codecs.SegmentInfoFormat.html">SegmentInfoFormat</a></h4> |
| <section><p>Expert: Controls the format of the |
| <a class="xref" href="Lucene.Net.Index.SegmentInfo.html">SegmentInfo</a> (segment metadata file). |
| <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.Codecs.SegmentInfoReader.html">SegmentInfoReader</a></h4> |
| <section><p>Specifies an API for classes that can read <a class="xref" href="Lucene.Net.Index.SegmentInfo.html">SegmentInfo</a> information. |
| <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.Codecs.SegmentInfoWriter.html">SegmentInfoWriter</a></h4> |
| <section><p>Specifies an API for classes that can write out <a class="xref" href="Lucene.Net.Index.SegmentInfo.html">SegmentInfo</a> data. |
| <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.Codecs.StoredFieldsFormat.html">StoredFieldsFormat</a></h4> |
| <section><p>Controls the format of stored fields.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.StoredFieldsReader.html">StoredFieldsReader</a></h4> |
| <section><p>Codec API for reading stored fields. |
| <p> |
| You need to implement <a class="xref" href="Lucene.Net.Codecs.StoredFieldsReader.html#Lucene_Net_Codecs_StoredFieldsReader_VisitDocument_System_Int32_Lucene_Net_Index_StoredFieldVisitor_">VisitDocument(Int32, StoredFieldVisitor)</a> to |
| read the stored fields for a document, implement <a class="xref" href="Lucene.Net.Codecs.StoredFieldsReader.html#Lucene_Net_Codecs_StoredFieldsReader_Clone">Clone()</a> (creating |
| clones of any <a class="xref" href="Lucene.Net.Store.IndexInput.html">IndexInput</a>s used, etc), and <a class="xref" href="Lucene.Net.Codecs.StoredFieldsReader.html#Lucene_Net_Codecs_StoredFieldsReader_Dispose_System_Boolean_">Dispose(Boolean)</a> |
| to cleanup any allocated resources. |
| <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.Codecs.StoredFieldsWriter.html">StoredFieldsWriter</a></h4> |
| <section><p>Codec API for writing stored fields: |
| <p> |
| <ol><li>For every document, <a class="xref" href="Lucene.Net.Codecs.StoredFieldsWriter.html#Lucene_Net_Codecs_StoredFieldsWriter_StartDocument_System_Int32_">StartDocument(Int32)</a> is called, |
| informing the Codec how many fields will be written.</li><li><a class="xref" href="Lucene.Net.Codecs.StoredFieldsWriter.html#Lucene_Net_Codecs_StoredFieldsWriter_WriteField_Lucene_Net_Index_FieldInfo_Lucene_Net_Index_IIndexableField_">WriteField(FieldInfo, IIndexableField)</a> is called for |
| each field in the document.</li><li>After all documents have been written, <a class="xref" href="Lucene.Net.Codecs.StoredFieldsWriter.html#Lucene_Net_Codecs_StoredFieldsWriter_Finish_Lucene_Net_Index_FieldInfos_System_Int32_">Finish(FieldInfos, Int32)</a> |
| is called for verification/sanity-checks.</li><li>Finally the writer is disposed (<a class="xref" href="Lucene.Net.Codecs.StoredFieldsWriter.html#Lucene_Net_Codecs_StoredFieldsWriter_Dispose_System_Boolean_">Dispose(Boolean)</a>)</li></ol> |
| <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.Codecs.TermsConsumer.html">TermsConsumer</a></h4> |
| <section><p>Abstract API that consumes terms for an individual field. |
| <p> |
| The lifecycle is: |
| <ol><li>TermsConsumer is returned for each field |
| by <a class="xref" href="Lucene.Net.Codecs.FieldsConsumer.html#Lucene_Net_Codecs_FieldsConsumer_AddField_Lucene_Net_Index_FieldInfo_">AddField(FieldInfo)</a>.</li><li>TermsConsumer returns a <a class="xref" href="Lucene.Net.Codecs.PostingsConsumer.html">PostingsConsumer</a> for |
| each term in <a class="xref" href="Lucene.Net.Codecs.TermsConsumer.html#Lucene_Net_Codecs_TermsConsumer_StartTerm_Lucene_Net_Util_BytesRef_">StartTerm(BytesRef)</a>.</li><li>When the producer (e.g. IndexWriter) |
| is done adding documents for the term, it calls |
| <a class="xref" href="Lucene.Net.Codecs.TermsConsumer.html#Lucene_Net_Codecs_TermsConsumer_FinishTerm_Lucene_Net_Util_BytesRef_Lucene_Net_Codecs_TermStats_">FinishTerm(BytesRef, TermStats)</a>, passing in |
| the accumulated term statistics.</li><li>Producer calls <a class="xref" href="Lucene.Net.Codecs.TermsConsumer.html#Lucene_Net_Codecs_TermsConsumer_Finish_System_Int64_System_Int64_System_Int32_">Finish(Int64, Int64, Int32)</a> with |
| the accumulated collection statistics when it is finished |
| adding terms to the field.</li></ol> |
| <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.Codecs.TermStats.html">TermStats</a></h4> |
| <section><p>Holder for per-term statistics.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.TermVectorsFormat.html">TermVectorsFormat</a></h4> |
| <section><p>Controls the format of term vectors.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.TermVectorsReader.html">TermVectorsReader</a></h4> |
| <section><p>Codec API for reading term vectors: |
| <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.Codecs.TermVectorsWriter.html">TermVectorsWriter</a></h4> |
| <section><p>Codec API for writing term vectors: |
| <p> |
| <ol><li>For every document, <a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_StartDocument_System_Int32_">StartDocument(Int32)</a> is called, |
| informing the <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> how many fields will be written.</li><li><a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_StartField_Lucene_Net_Index_FieldInfo_System_Int32_System_Boolean_System_Boolean_System_Boolean_">StartField(FieldInfo, Int32, Boolean, Boolean, Boolean)</a> is called for |
| each field in the document, informing the codec how many terms |
| will be written for that field, and whether or not positions, |
| offsets, or payloads are enabled.</li><li>Within each field, <a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_StartTerm_Lucene_Net_Util_BytesRef_System_Int32_">StartTerm(BytesRef, Int32)</a> is called |
| for each term.</li><li>If offsets and/or positions are enabled, then |
| <a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_AddPosition_System_Int32_System_Int32_System_Int32_Lucene_Net_Util_BytesRef_">AddPosition(Int32, Int32, Int32, BytesRef)</a> will be called for each term |
| occurrence.</li><li>After all documents have been written, <a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_Finish_Lucene_Net_Index_FieldInfos_System_Int32_">Finish(FieldInfos, Int32)</a> |
| is called for verification/sanity-checks.</li><li>Finally the writer is disposed (<a class="xref" href="Lucene.Net.Codecs.TermVectorsWriter.html#Lucene_Net_Codecs_TermVectorsWriter_Dispose_System_Boolean_">Dispose(Boolean)</a>)</li></ol> |
| <p> |
| <div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></section> |
| <h3 id="interfaces">Interfaces |
| </h3> |
| <h4><a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a></h4> |
| <section><p>Contract for extending the functionality of <a class="xref" href="Lucene.Net.Codecs.Codec.html">Codec</a> implementations so |
| they can be injected with dependencies. |
| <p> |
| To set the <a class="xref" href="Lucene.Net.Codecs.ICodecFactory.html">ICodecFactory</a>, call <a class="xref" href="Lucene.Net.Codecs.Codec.html#Lucene_Net_Codecs_Codec_SetCodecFactory_Lucene_Net_Codecs_ICodecFactory_">SetCodecFactory(ICodecFactory)</a>. |
| <p> |
| See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for some common usage examples.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a></h4> |
| <section><p>Contract for extending the functionality of <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html">DocValuesFormat</a> implementations so |
| they can be injected with dependencies. |
| <p> |
| To set the <a class="xref" href="Lucene.Net.Codecs.IDocValuesFormatFactory.html">IDocValuesFormatFactory</a>, call <a class="xref" href="Lucene.Net.Codecs.DocValuesFormat.html#Lucene_Net_Codecs_DocValuesFormat_SetDocValuesFormatFactory_Lucene_Net_Codecs_IDocValuesFormatFactory_">SetDocValuesFormatFactory(IDocValuesFormatFactory)</a>. |
| <p> |
| See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for some common usage examples.</p> |
| </section> |
| <h4><a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a></h4> |
| <section><p>Contract for extending the functionality of <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html">PostingsFormat</a> implementations so |
| they can be injected with dependencies. |
| <p> |
| To set the <a class="xref" href="Lucene.Net.Codecs.IPostingsFormatFactory.html">IPostingsFormatFactory</a>, call <a class="xref" href="Lucene.Net.Codecs.PostingsFormat.html#Lucene_Net_Codecs_PostingsFormat_SetPostingsFormatFactory_Lucene_Net_Codecs_IPostingsFormatFactory_">SetPostingsFormatFactory(IPostingsFormatFactory)</a>. |
| <p> |
| See the <a class="xref" href="Lucene.Net.Codecs.html">Lucene.Net.Codecs</a> namespace documentation for some common usage examples.</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-beta00011/websites/apidocs/apiSpec/core/Lucene_Net_Codecs.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 Licensed to the Apache Software Foundation (ASF) |
| |
| </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> |