Return-Path:
X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io
Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io
Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183])
by cust-asf2.ponee.io (Postfix) with ESMTP id 2499F200C4C
for ; Tue, 4 Apr 2017 19:19:14 +0200 (CEST)
Received: by cust-asf.ponee.io (Postfix)
id 236AC160BAF; Tue, 4 Apr 2017 17:19:14 +0000 (UTC)
Delivered-To: archive-asf-public@cust-asf.ponee.io
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by cust-asf.ponee.io (Postfix) with SMTP id D12EF160BA5
for ; Tue, 4 Apr 2017 19:19:11 +0200 (CEST)
Received: (qmail 50923 invoked by uid 500); 4 Apr 2017 17:19:09 -0000
Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: lucene-net-dev@lucenenet.apache.org
Delivered-To: mailing list commits@lucenenet.apache.org
Received: (qmail 49411 invoked by uid 99); 4 Apr 2017 17:19:08 -0000
Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23)
by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2017 17:19:08 +0000
Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33)
id ADFEADFE59; Tue, 4 Apr 2017 17:19:08 +0000 (UTC)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: nightowl888@apache.org
To: commits@lucenenet.apache.org
Date: Tue, 04 Apr 2017 17:19:36 -0000
Message-Id: <97c3b7aafa404b49b06d152a8867ca3f@git.apache.org>
In-Reply-To: <937e795e09544d619dd5cda8869fe2af@git.apache.org>
References: <937e795e09544d619dd5cda8869fe2af@git.apache.org>
X-Mailer: ASF-Git Admin Mailer
Subject: [30/62] [abbrv] [partial] lucenenet git commit: Renamed
Lucene.Net.Core folder Lucene.Net because the dotnet.exe pack command doesn't
allow creating a NuGet package with a different name than its folder. Working
around it with the script was much more co
archived-at: Tue, 04 Apr 2017 17:19:14 -0000
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46Codec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46Codec.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46Codec.cs
deleted file mode 100644
index 960138f..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46Codec.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- using Lucene40LiveDocsFormat = Lucene.Net.Codecs.Lucene40.Lucene40LiveDocsFormat;
- using Lucene41StoredFieldsFormat = Lucene.Net.Codecs.Lucene41.Lucene41StoredFieldsFormat;
- using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat;
- using Lucene42TermVectorsFormat = Lucene.Net.Codecs.Lucene42.Lucene42TermVectorsFormat;
- using PerFieldDocValuesFormat = Lucene.Net.Codecs.PerField.PerFieldDocValuesFormat;
- using PerFieldPostingsFormat = Lucene.Net.Codecs.PerField.PerFieldPostingsFormat;
-
- ///
- /// Implements the Lucene 4.6 index format, with configurable per-field postings
- /// and docvalues formats.
- ///
- /// If you want to reuse functionality of this codec in another codec, extend
- /// .
- ///
- ///
- // NOTE: if we make largish changes in a minor release, easier to just make Lucene46Codec or whatever
- // if they are backwards compatible or smallish we can probably do the backwards in the postingsreader
- // (it writes a minor version, etc).
- [CodecName("Lucene46")]
- public class Lucene46Codec : Codec
- {
- private readonly StoredFieldsFormat fieldsFormat = new Lucene41StoredFieldsFormat();
- private readonly TermVectorsFormat vectorsFormat = new Lucene42TermVectorsFormat();
- private readonly FieldInfosFormat fieldInfosFormat = new Lucene46FieldInfosFormat();
- private readonly SegmentInfoFormat segmentInfosFormat = new Lucene46SegmentInfoFormat();
- private readonly LiveDocsFormat liveDocsFormat = new Lucene40LiveDocsFormat();
-
- private readonly PostingsFormat postingsFormat;
-
- private class PerFieldPostingsFormatAnonymousInnerClassHelper : PerFieldPostingsFormat
- {
- private readonly Lucene46Codec outerInstance;
-
- public PerFieldPostingsFormatAnonymousInnerClassHelper(Lucene46Codec outerInstance)
- {
- this.outerInstance = outerInstance;
- }
-
- public override PostingsFormat GetPostingsFormatForField(string field)
- {
- return outerInstance.GetPostingsFormatForField(field);
- }
- }
-
- private readonly DocValuesFormat docValuesFormat;
-
- private class PerFieldDocValuesFormatAnonymousInnerClassHelper : PerFieldDocValuesFormat
- {
- private readonly Lucene46Codec outerInstance;
-
- public PerFieldDocValuesFormatAnonymousInnerClassHelper(Lucene46Codec outerInstance)
- {
- this.outerInstance = outerInstance;
- }
-
- public override DocValuesFormat GetDocValuesFormatForField(string field)
- {
- return outerInstance.GetDocValuesFormatForField(field);
- }
- }
-
- ///
- /// Sole constructor.
- public Lucene46Codec()
- : base()
- {
- postingsFormat = new PerFieldPostingsFormatAnonymousInnerClassHelper(this);
- docValuesFormat = new PerFieldDocValuesFormatAnonymousInnerClassHelper(this);
- }
-
- public override sealed StoredFieldsFormat StoredFieldsFormat
- {
- get { return fieldsFormat; }
- }
-
- public override sealed TermVectorsFormat TermVectorsFormat
- {
- get { return vectorsFormat; }
- }
-
- public override sealed PostingsFormat PostingsFormat
- {
- get { return postingsFormat; }
- }
-
- public override sealed FieldInfosFormat FieldInfosFormat
- {
- get { return fieldInfosFormat; }
- }
-
- public override sealed SegmentInfoFormat SegmentInfoFormat
- {
- get { return segmentInfosFormat; }
- }
-
- public override sealed LiveDocsFormat LiveDocsFormat
- {
- get { return liveDocsFormat; }
- }
-
- ///
- /// Returns the postings format that should be used for writing
- /// new segments of field
.
- ///
- /// The default implementation always returns "Lucene41"
- ///
- public virtual PostingsFormat GetPostingsFormatForField(string field)
- {
- return defaultFormat;
- }
-
- ///
- /// Returns the docvalues format that should be used for writing
- /// new segments of field
.
- ///
- /// The default implementation always returns "Lucene45"
- ///
- public virtual DocValuesFormat GetDocValuesFormatForField(string field)
- {
- return defaultDVFormat;
- }
-
- public override sealed DocValuesFormat DocValuesFormat
- {
- get { return docValuesFormat; }
- }
-
- private readonly PostingsFormat defaultFormat = Codecs.PostingsFormat.ForName("Lucene41");
- private readonly DocValuesFormat defaultDVFormat = Codecs.DocValuesFormat.ForName("Lucene45");
-
- private readonly NormsFormat normsFormat = new Lucene42NormsFormat();
-
- public override sealed NormsFormat NormsFormat
- {
- get { return normsFormat; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosFormat.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosFormat.cs
deleted file mode 100644
index 40c681c..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosFormat.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- ///
- /// Lucene 4.6 Field Infos format.
- ///
- ///
Field names are stored in the field info file, with suffix .fnm.
- /// FieldInfos (.fnm) --> Header,FieldsCount, <FieldName,FieldNumber,
- /// FieldBits,DocValuesBits,DocValuesGen,Attributes> FieldsCount,Footer
- /// Data types:
- ///
- /// - Header -->
- /// - FieldsCount -->
- /// - FieldName -->
- /// - FieldBits, DocValuesBits -->
- /// - FieldNumber -->
- /// - Attributes -->
- /// - DocValuesGen -->
- /// - Footer -->
- ///
- ///
- /// Field Descriptions:
- ///
- /// - FieldsCount: the number of fields in this file.
- /// - FieldName: name of the field as a UTF-8 String.
- /// - FieldNumber: the field's number. Note that unlike previous versions of
- /// Lucene, the fields are not numbered implicitly by their order in the
- /// file, instead explicitly.
- /// - FieldBits: a byte containing field options.
- ///
- /// - The low-order bit is one for indexed fields, and zero for non-indexed
- /// fields.
- /// - The second lowest-order bit is one for fields that have term vectors
- /// stored, and zero for fields without term vectors.
- /// - If the third lowest order-bit is set (0x4), offsets are stored into
- /// the postings list in addition to positions.
- /// - Fourth bit is unused.
- /// - If the fifth lowest-order bit is set (0x10), norms are omitted for the
- /// indexed field.
- /// - If the sixth lowest-order bit is set (0x20), payloads are stored for the
- /// indexed field.
- /// - If the seventh lowest-order bit is set (0x40), term frequencies and
- /// positions omitted for the indexed field.
- /// - If the eighth lowest-order bit is set (0x80), positions are omitted for the
- /// indexed field.
- ///
- ///
- /// - DocValuesBits: a byte containing per-document value types. The type
- /// recorded as two four-bit integers, with the high-order bits representing
- ///
norms
options, and the low-order bits representing
- /// {@code DocValues} options. Each four-bit integer can be decoded as such:
- ///
- /// - 0: no DocValues for this field.
- /// - 1: NumericDocValues. ()
- /// - 2: BinaryDocValues. ({@code DocValuesType#BINARY})
- /// - 3: SortedDocValues. ({@code DocValuesType#SORTED})
- ///
- ///
- /// - DocValuesGen is the generation count of the field's DocValues. If this is -1,
- /// there are no DocValues updates to that field. Anything above zero means there
- /// are updates stored by .
- /// - Attributes: a key-value map of codec-private attributes.
- ///
- ///
- /// @lucene.experimental
- ///
- public sealed class Lucene46FieldInfosFormat : FieldInfosFormat
- {
- private readonly FieldInfosReader reader = new Lucene46FieldInfosReader();
- private readonly FieldInfosWriter writer = new Lucene46FieldInfosWriter();
-
- ///
- /// Sole constructor.
- public Lucene46FieldInfosFormat()
- {
- }
-
- public override FieldInfosReader FieldInfosReader
- {
- get
- {
- return reader;
- }
- }
-
- public override FieldInfosWriter FieldInfosWriter
- {
- get
- {
- return writer;
- }
- }
-
- ///
- /// Extension of field infos
- internal const string EXTENSION = "fnm";
-
- // Codec header
- internal const string CODEC_NAME = "Lucene46FieldInfos";
-
- internal const int FORMAT_START = 0;
- internal const int FORMAT_CHECKSUM = 1;
- internal const int FORMAT_CURRENT = FORMAT_CHECKSUM;
-
- // Field flags
- internal const sbyte IS_INDEXED = 0x1;
-
- internal const sbyte STORE_TERMVECTOR = 0x2;
- internal const sbyte STORE_OFFSETS_IN_POSTINGS = 0x4;
- internal const sbyte OMIT_NORMS = 0x10;
- internal const sbyte STORE_PAYLOADS = 0x20;
- internal const sbyte OMIT_TERM_FREQ_AND_POSITIONS = 0x40;
- internal const sbyte OMIT_POSITIONS = -128;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
deleted file mode 100644
index 0a3bacc..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-using Lucene.Net.Support;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- using ChecksumIndexInput = Lucene.Net.Store.ChecksumIndexInput;
- using CorruptIndexException = Lucene.Net.Index.CorruptIndexException;
- using DocValuesType = Lucene.Net.Index.DocValuesType;
- using Directory = Lucene.Net.Store.Directory;
- using FieldInfo = Lucene.Net.Index.FieldInfo;
- using FieldInfos = Lucene.Net.Index.FieldInfos;
- using IndexFileNames = Lucene.Net.Index.IndexFileNames;
- using IndexInput = Lucene.Net.Store.IndexInput;
- using IndexOptions = Lucene.Net.Index.IndexOptions;
- using IOContext = Lucene.Net.Store.IOContext;
- using IOUtils = Lucene.Net.Util.IOUtils;
-
- ///
- /// Lucene 4.6 FieldInfos reader.
- ///
- /// @lucene.experimental
- ///
- internal sealed class Lucene46FieldInfosReader : FieldInfosReader
- {
- ///
- /// Sole constructor.
- public Lucene46FieldInfosReader()
- {
- }
-
- public override FieldInfos Read(Directory directory, string segmentName, string segmentSuffix, IOContext context)
- {
- string fileName = IndexFileNames.SegmentFileName(segmentName, segmentSuffix, Lucene46FieldInfosFormat.EXTENSION);
- ChecksumIndexInput input = directory.OpenChecksumInput(fileName, context);
-
- bool success = false;
- try
- {
- int codecVersion = CodecUtil.CheckHeader(input, Lucene46FieldInfosFormat.CODEC_NAME, Lucene46FieldInfosFormat.FORMAT_START, Lucene46FieldInfosFormat.FORMAT_CURRENT);
-
- int size = input.ReadVInt32(); //read in the size
- FieldInfo[] infos = new FieldInfo[size];
-
- for (int i = 0; i < size; i++)
- {
- string name = input.ReadString();
- int fieldNumber = input.ReadVInt32();
- byte bits = input.ReadByte();
- bool isIndexed = (bits & Lucene46FieldInfosFormat.IS_INDEXED) != 0;
- bool storeTermVector = (bits & Lucene46FieldInfosFormat.STORE_TERMVECTOR) != 0;
- bool omitNorms = (bits & Lucene46FieldInfosFormat.OMIT_NORMS) != 0;
- bool storePayloads = (bits & Lucene46FieldInfosFormat.STORE_PAYLOADS) != 0;
- IndexOptions indexOptions;
- if (!isIndexed)
- {
- indexOptions = IndexOptions.NONE;
- }
- else if ((bits & Lucene46FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS) != 0)
- {
- indexOptions = IndexOptions.DOCS_ONLY;
- }
- else if ((bits & Lucene46FieldInfosFormat.OMIT_POSITIONS) != 0)
- {
- indexOptions = IndexOptions.DOCS_AND_FREQS;
- }
- else if ((bits & Lucene46FieldInfosFormat.STORE_OFFSETS_IN_POSTINGS) != 0)
- {
- indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
- }
- else
- {
- indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
- }
-
- // DV Types are packed in one byte
- byte val = input.ReadByte();
- DocValuesType docValuesType = GetDocValuesType(input, (sbyte)(val & 0x0F));
- DocValuesType normsType = GetDocValuesType(input, (sbyte)(((int)((uint)val >> 4)) & 0x0F));
- long dvGen = input.ReadInt64();
- IDictionary attributes = input.ReadStringStringMap();
- infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, normsType, Collections.UnmodifiableMap(attributes));
- infos[i].DocValuesGen = dvGen;
- }
-
- if (codecVersion >= Lucene46FieldInfosFormat.FORMAT_CHECKSUM)
- {
- CodecUtil.CheckFooter(input);
- }
- else
- {
-#pragma warning disable 612, 618
- CodecUtil.CheckEOF(input);
-#pragma warning restore 612, 618
- }
- FieldInfos fieldInfos = new FieldInfos(infos);
- success = true;
- return fieldInfos;
- }
- finally
- {
- if (success)
- {
- input.Dispose();
- }
- else
- {
- IOUtils.CloseWhileHandlingException(input);
- }
- }
- }
-
- private static DocValuesType GetDocValuesType(IndexInput input, sbyte b)
- {
- if (b == 0)
- {
- return DocValuesType.NONE;
- }
- else if (b == 1)
- {
- return DocValuesType.NUMERIC;
- }
- else if (b == 2)
- {
- return DocValuesType.BINARY;
- }
- else if (b == 3)
- {
- return DocValuesType.SORTED;
- }
- else if (b == 4)
- {
- return DocValuesType.SORTED_SET;
- }
- else
- {
- throw new CorruptIndexException("invalid docvalues byte: " + b + " (resource=" + input + ")");
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
deleted file mode 100644
index b1732da..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- using Directory = Lucene.Net.Store.Directory;
- using DocValuesType = Lucene.Net.Index.DocValuesType;
- using FieldInfo = Lucene.Net.Index.FieldInfo;
- using FieldInfos = Lucene.Net.Index.FieldInfos;
- using IndexFileNames = Lucene.Net.Index.IndexFileNames;
- using IndexOptions = Lucene.Net.Index.IndexOptions;
- using IndexOutput = Lucene.Net.Store.IndexOutput;
- using IOContext = Lucene.Net.Store.IOContext;
- using IOUtils = Lucene.Net.Util.IOUtils;
-
- ///
- /// Lucene 4.6 FieldInfos writer.
- ///
- ///
- internal sealed class Lucene46FieldInfosWriter : FieldInfosWriter
- {
- ///
- /// Sole constructor.
- public Lucene46FieldInfosWriter()
- {
- }
-
- public override void Write(Directory directory, string segmentName, string segmentSuffix, FieldInfos infos, IOContext context)
- {
- string fileName = IndexFileNames.SegmentFileName(segmentName, segmentSuffix, Lucene46FieldInfosFormat.EXTENSION);
- IndexOutput output = directory.CreateOutput(fileName, context);
- bool success = false;
- try
- {
- CodecUtil.WriteHeader(output, Lucene46FieldInfosFormat.CODEC_NAME, Lucene46FieldInfosFormat.FORMAT_CURRENT);
- output.WriteVInt32(infos.Count);
- foreach (FieldInfo fi in infos)
- {
- IndexOptions indexOptions = fi.IndexOptions;
- sbyte bits = 0x0;
- if (fi.HasVectors)
- {
- bits |= Lucene46FieldInfosFormat.STORE_TERMVECTOR;
- }
- if (fi.OmitsNorms)
- {
- bits |= Lucene46FieldInfosFormat.OMIT_NORMS;
- }
- if (fi.HasPayloads)
- {
- bits |= Lucene46FieldInfosFormat.STORE_PAYLOADS;
- }
- if (fi.IsIndexed)
- {
- bits |= Lucene46FieldInfosFormat.IS_INDEXED;
- Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.HasPayloads);
- if (indexOptions == IndexOptions.DOCS_ONLY)
- {
- bits |= Lucene46FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS;
- }
- else if (indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
- {
- bits |= Lucene46FieldInfosFormat.STORE_OFFSETS_IN_POSTINGS;
- }
- else if (indexOptions == IndexOptions.DOCS_AND_FREQS)
- {
- bits |= Lucene46FieldInfosFormat.OMIT_POSITIONS;
- }
- }
- output.WriteString(fi.Name);
- output.WriteVInt32(fi.Number);
- output.WriteByte((byte)bits);
-
- // pack the DV types in one byte
- var dv = DocValuesByte(fi.DocValuesType);
- var nrm = DocValuesByte(fi.NormType);
- Debug.Assert((dv & (~0xF)) == 0 && (nrm & (~0x0F)) == 0);
- var val = unchecked((sbyte)(0xff & ((nrm << 4) | dv)));
- output.WriteByte((byte)val);
- output.WriteInt64(fi.DocValuesGen);
- output.WriteStringStringMap(fi.Attributes);
- }
- CodecUtil.WriteFooter(output);
- success = true;
- }
- finally
- {
- if (success)
- {
- output.Dispose();
- }
- else
- {
- IOUtils.CloseWhileHandlingException(output);
- }
- }
- }
-
- private static sbyte DocValuesByte(DocValuesType type)
- {
- if (type == DocValuesType.NONE)
- {
- return 0;
- }
- else if (type == DocValuesType.NUMERIC)
- {
- return 1;
- }
- else if (type == DocValuesType.BINARY)
- {
- return 2;
- }
- else if (type == DocValuesType.SORTED)
- {
- return 3;
- }
- else if (type == DocValuesType.SORTED_SET)
- {
- return 4;
- }
- else
- {
- throw new InvalidOperationException();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoFormat.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoFormat.cs
deleted file mode 100644
index f50fecc..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoFormat.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- // javadocs
- using SegmentInfo = Lucene.Net.Index.SegmentInfo; // javadocs
-
- // javadocs
- // javadocs
-
- ///
- /// Lucene 4.6 Segment info format.
- ///
- /// Files:
- ///
- /// - .si: Header, SegVersion, SegSize, IsCompoundFile, Diagnostics, Files, Footer
- ///
- ///
- /// Data types:
- ///
- ///
- /// - Header -->
- /// - SegSize -->
- /// - SegVersion -->
- /// - Files -->
- /// - Diagnostics -->
- /// - IsCompoundFile -->
- /// - Footer -->
- ///
- ///
- /// Field Descriptions:
- ///
- ///
- /// - SegVersion is the code version that created the segment.
- /// - SegSize is the number of documents contained in the segment index.
- /// - IsCompoundFile records whether the segment is written as a compound file or
- /// not. If this is -1, the segment is not a compound file. If it is 1, the segment
- /// is a compound file.
- /// - The Diagnostics Map is privately written by , as a debugging aid,
- /// for each segment it creates. It includes metadata like the current Lucene
- /// version, OS, Java version, why the segment was created (merge, flush,
- /// addIndexes), etc.
- /// - Files is a list of files referred to by this segment.
- ///
- ///
- ///
- ///
- public class Lucene46SegmentInfoFormat : SegmentInfoFormat
- {
- private readonly SegmentInfoReader reader = new Lucene46SegmentInfoReader();
- private readonly SegmentInfoWriter writer = new Lucene46SegmentInfoWriter();
-
- ///
- /// Sole constructor.
- public Lucene46SegmentInfoFormat()
- {
- }
-
- public override SegmentInfoReader SegmentInfoReader
- {
- get
- {
- return reader;
- }
- }
-
- public override SegmentInfoWriter SegmentInfoWriter
- {
- get
- {
- return writer;
- }
- }
-
- ///
- /// File extension used to store .
- public readonly static string SI_EXTENSION = "si";
-
- internal const string CODEC_NAME = "Lucene46SegmentInfo";
- internal const int VERSION_START = 0;
- internal const int VERSION_CHECKSUM = 1;
- internal const int VERSION_CURRENT = VERSION_CHECKSUM;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoReader.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoReader.cs
deleted file mode 100644
index 6cb374e..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoReader.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using System.Collections.Generic;
-
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- using ChecksumIndexInput = Lucene.Net.Store.ChecksumIndexInput;
- using CorruptIndexException = Lucene.Net.Index.CorruptIndexException;
- using Directory = Lucene.Net.Store.Directory;
- using IndexFileNames = Lucene.Net.Index.IndexFileNames;
- using IOContext = Lucene.Net.Store.IOContext;
- using IOUtils = Lucene.Net.Util.IOUtils;
- using SegmentInfo = Lucene.Net.Index.SegmentInfo;
-
- ///
- /// Lucene 4.6 implementation of .
- ///
- ///
- public class Lucene46SegmentInfoReader : SegmentInfoReader
- {
- ///
- /// Sole constructor.
- public Lucene46SegmentInfoReader()
- {
- }
-
- public override SegmentInfo Read(Directory dir, string segment, IOContext context)
- {
- string fileName = IndexFileNames.SegmentFileName(segment, "", Lucene46SegmentInfoFormat.SI_EXTENSION);
- ChecksumIndexInput input = dir.OpenChecksumInput(fileName, context);
- bool success = false;
- try
- {
- int codecVersion = CodecUtil.CheckHeader(input, Lucene46SegmentInfoFormat.CODEC_NAME, Lucene46SegmentInfoFormat.VERSION_START, Lucene46SegmentInfoFormat.VERSION_CURRENT);
- string version = input.ReadString();
- int docCount = input.ReadInt32();
- if (docCount < 0)
- {
- throw new CorruptIndexException("invalid docCount: " + docCount + " (resource=" + input + ")");
- }
- bool isCompoundFile = input.ReadByte() == SegmentInfo.YES;
- IDictionary diagnostics = input.ReadStringStringMap();
- ISet files = input.ReadStringSet();
-
- if (codecVersion >= Lucene46SegmentInfoFormat.VERSION_CHECKSUM)
- {
- CodecUtil.CheckFooter(input);
- }
- else
- {
-#pragma warning disable 612, 618
- CodecUtil.CheckEOF(input);
-#pragma warning restore 612, 618
- }
-
- SegmentInfo si = new SegmentInfo(dir, version, segment, docCount, isCompoundFile, null, diagnostics);
- si.SetFiles(files);
-
- success = true;
-
- return si;
- }
- finally
- {
- if (!success)
- {
- IOUtils.CloseWhileHandlingException(input);
- }
- else
- {
- input.Dispose();
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
deleted file mode 100644
index 9cf8da9..0000000
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46SegmentInfoWriter.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-namespace Lucene.Net.Codecs.Lucene46
-{
- /*
- * 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.
- */
-
- using Directory = Lucene.Net.Store.Directory;
- using FieldInfos = Lucene.Net.Index.FieldInfos;
- using IndexFileNames = Lucene.Net.Index.IndexFileNames;
- using IndexOutput = Lucene.Net.Store.IndexOutput;
- using IOContext = Lucene.Net.Store.IOContext;
- using IOUtils = Lucene.Net.Util.IOUtils;
- using SegmentInfo = Lucene.Net.Index.SegmentInfo;
-
- ///
- /// Lucene 4.0 implementation of .
- ///
- ///
- public class Lucene46SegmentInfoWriter : SegmentInfoWriter
- {
- ///
- /// Sole constructor.
- public Lucene46SegmentInfoWriter()
- {
- }
-
- ///
- /// Save a single segment's info.
- public override void Write(Directory dir, SegmentInfo si, FieldInfos fis, IOContext ioContext)
- {
- string fileName = IndexFileNames.SegmentFileName(si.Name, "", Lucene46SegmentInfoFormat.SI_EXTENSION);
- si.AddFile(fileName);
-
- IndexOutput output = dir.CreateOutput(fileName, ioContext);
-
- bool success = false;
- try
- {
- CodecUtil.WriteHeader(output, Lucene46SegmentInfoFormat.CODEC_NAME, Lucene46SegmentInfoFormat.VERSION_CURRENT);
- // Write the Lucene version that created this segment, since 3.1
- output.WriteString(si.Version);
- output.WriteInt32(si.DocCount);
-
- output.WriteByte((byte)(sbyte)(si.UseCompoundFile ? SegmentInfo.YES : SegmentInfo.NO));
- output.WriteStringStringMap(si.Diagnostics);
- output.WriteStringSet(si.GetFiles());
- CodecUtil.WriteFooter(output);
- success = true;
- }
- finally
- {
- if (!success)
- {
- IOUtils.CloseWhileHandlingException(output);
- si.Dir.DeleteFile(fileName);
- }
- else
- {
- output.Dispose();
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs b/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
deleted file mode 100644
index 15daee5..0000000
--- a/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-using Lucene.Net.Support;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * 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.
- */
-
- using BytesRef = Lucene.Net.Util.BytesRef;
- using DocsAndPositionsEnum = Lucene.Net.Index.DocsAndPositionsEnum;
- using MergeState = Lucene.Net.Index.MergeState;
- using MultiDocsAndPositionsEnum = Lucene.Net.Index.MultiDocsAndPositionsEnum;
-
- ///
- /// Exposes flex API, merged from flex API of sub-segments,
- /// remapping docIDs (this is used for segment merging).
- ///
- /// @lucene.experimental
- ///
- public sealed class MappingMultiDocsAndPositionsEnum : DocsAndPositionsEnum
- {
- private MultiDocsAndPositionsEnum.EnumWithSlice[] subs;
- internal int numSubs;
- internal int upto;
- internal MergeState.DocMap currentMap;
- internal DocsAndPositionsEnum current;
- internal int currentBase;
- internal int doc = -1;
- private MergeState mergeState;
-
- ///
- /// Sole constructor.
- public MappingMultiDocsAndPositionsEnum()
- {
- }
-
- internal MappingMultiDocsAndPositionsEnum Reset(MultiDocsAndPositionsEnum postingsEnum)
- {
- this.numSubs = postingsEnum.NumSubs;
- this.subs = postingsEnum.Subs;
- upto = -1;
- current = null;
- return this;
- }
-
- ///
- /// Sets the , which is used to re-map
- /// document IDs.
- ///
- public MergeState MergeState
- {
- get
- {
- return this.mergeState; // LUCENENET specific - per MSDN properties should always have a getter
- }
- set
- {
- this.mergeState = value;
- }
- }
-
- ///
- /// How many sub-readers we are merging.
- ///
- public int NumSubs
- {
- get
- {
- return numSubs;
- }
- }
-
- ///
- /// Returns sub-readers we are merging.
- [WritableArray]
- [SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
- public MultiDocsAndPositionsEnum.EnumWithSlice[] Subs
- {
- get { return subs; }
- }
-
- public override int Freq
- {
- get { return current.Freq; }
- }
-
- public override int DocID
- {
- get { return doc; }
- }
-
- public override int Advance(int target)
- {
- throw new System.NotSupportedException();
- }
-
- public override int NextDoc()
- {
- while (true)
- {
- if (current == null)
- {
- if (upto == numSubs - 1)
- {
- return this.doc = NO_MORE_DOCS;
- }
- else
- {
- upto++;
- int reader = subs[upto].Slice.ReaderIndex;
- current = subs[upto].DocsAndPositionsEnum;
- currentBase = mergeState.DocBase[reader];
- currentMap = mergeState.DocMaps[reader];
- }
- }
-
- int doc = current.NextDoc();
- if (doc != NO_MORE_DOCS)
- {
- // compact deletions
- doc = currentMap.Get(doc);
- if (doc == -1)
- {
- continue;
- }
- return this.doc = currentBase + doc;
- }
- else
- {
- current = null;
- }
- }
- }
-
- public override int NextPosition()
- {
- return current.NextPosition();
- }
-
- public override int StartOffset
- {
- get { return current.StartOffset; }
- }
-
- public override int EndOffset
- {
- get { return current.EndOffset; }
- }
-
- public override BytesRef GetPayload()
- {
- return current.GetPayload();
- }
-
- public override long GetCost()
- {
- long cost = 0;
- foreach (MultiDocsAndPositionsEnum.EnumWithSlice enumWithSlice in subs)
- {
- cost += enumWithSlice.DocsAndPositionsEnum.GetCost();
- }
- return cost;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/MappingMultiDocsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/MappingMultiDocsEnum.cs b/src/Lucene.Net.Core/Codecs/MappingMultiDocsEnum.cs
deleted file mode 100644
index b16b2ab..0000000
--- a/src/Lucene.Net.Core/Codecs/MappingMultiDocsEnum.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using Lucene.Net.Support;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * 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.
- */
-
- using DocsEnum = Lucene.Net.Index.DocsEnum;
- using MergeState = Lucene.Net.Index.MergeState;
- using MultiDocsEnum = Lucene.Net.Index.MultiDocsEnum;
-
- ///
- /// Exposes flex API, merged from flex API of sub-segments,
- /// remapping docIDs (this is used for segment merging).
- ///
- /// @lucene.experimental
- ///
- public sealed class MappingMultiDocsEnum : DocsEnum
- {
- private MultiDocsEnum.EnumWithSlice[] subs;
- internal int numSubs;
- internal int upto;
- internal MergeState.DocMap currentMap;
- internal DocsEnum current;
- internal int currentBase;
- internal int doc = -1;
- private MergeState mergeState;
-
- ///
- /// Sole constructor.
- public MappingMultiDocsEnum()
- {
- }
-
- internal MappingMultiDocsEnum Reset(MultiDocsEnum docsEnum)
- {
- this.numSubs = docsEnum.NumSubs;
- this.subs = docsEnum.Subs;
- upto = -1;
- current = null;
- return this;
- }
-
- ///
- /// Sets the , which is used to re-map
- /// document IDs.
- ///
- public MergeState MergeState
- {
- get
- {
- return this.mergeState; // LUCENENET specific - per MSDN properties should always have a getter
- }
- set
- {
- this.mergeState = value;
- }
- }
-
- ///
- /// How many sub-readers we are merging.
- ///
- public int NumSubs
- {
- get
- {
- return numSubs;
- }
- }
-
- ///
- /// Returns sub-readers we are merging.
- [WritableArray]
- [SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
- public MultiDocsEnum.EnumWithSlice[] Subs
- {
- get { return subs; }
- }
-
- public override int Freq
- {
- get { return current.Freq; }
- }
-
- public override int DocID
- {
- get { return doc; }
- }
-
- public override int Advance(int target)
- {
- throw new System.NotSupportedException();
- }
-
- public override int NextDoc()
- {
- while (true)
- {
- if (current == null)
- {
- if (upto == numSubs - 1)
- {
- return this.doc = NO_MORE_DOCS;
- }
- else
- {
- upto++;
- int reader = subs[upto].Slice.ReaderIndex;
- current = subs[upto].DocsEnum;
- currentBase = mergeState.DocBase[reader];
- currentMap = mergeState.DocMaps[reader];
- Debug.Assert(currentMap.MaxDoc == subs[upto].Slice.Length, "readerIndex=" + reader + " subs.len=" + subs.Length + " len1=" + currentMap.MaxDoc + " vs " + subs[upto].Slice.Length);
- }
- }
-
- int doc = current.NextDoc();
- if (doc != NO_MORE_DOCS)
- {
- // compact deletions
- doc = currentMap.Get(doc);
- if (doc == -1)
- {
- continue;
- }
- return this.doc = currentBase + doc;
- }
- else
- {
- current = null;
- }
- }
- }
-
- public override long GetCost()
- {
- long cost = 0;
- foreach (MultiDocsEnum.EnumWithSlice enumWithSlice in subs)
- {
- cost += enumWithSlice.DocsEnum.GetCost();
- }
- return cost;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/MultiLevelSkipListReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/MultiLevelSkipListReader.cs b/src/Lucene.Net.Core/Codecs/MultiLevelSkipListReader.cs
deleted file mode 100644
index 0399aaa..0000000
--- a/src/Lucene.Net.Core/Codecs/MultiLevelSkipListReader.cs
+++ /dev/null
@@ -1,376 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * 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.
- */
-
- using BufferedIndexInput = Lucene.Net.Store.BufferedIndexInput;
- using IndexInput = Lucene.Net.Store.IndexInput;
- using MathUtil = Lucene.Net.Util.MathUtil;
-
- ///
- /// this abstract class reads skip lists with multiple levels.
- ///
- /// See for the information about the encoding
- /// of the multi level skip lists.
- ///
- /// Subclasses must implement the abstract method
- /// which defines the actual format of the skip data.
- /// @lucene.experimental
- ///
-
- public abstract class MultiLevelSkipListReader : IDisposable
- {
- ///
- /// the maximum number of skip levels possible for this index
- protected internal int m_maxNumberOfSkipLevels;
-
- // number of levels in this skip list
- private int numberOfSkipLevels;
-
- // Expert: defines the number of top skip levels to buffer in memory.
- // Reducing this number results in less memory usage, but possibly
- // slower performance due to more random I/Os.
- // Please notice that the space each level occupies is limited by
- // the skipInterval. The top level can not contain more than
- // skipLevel entries, the second top level can not contain more
- // than skipLevel^2 entries and so forth.
- private int numberOfLevelsToBuffer = 1;
-
- private int docCount;
- private bool haveSkipped;
-
- ///
- /// skipStream for each level.
- private IndexInput[] skipStream;
-
- ///
- /// The start pointer of each skip level.
- private long[] skipPointer;
-
- ///
- /// skipInterval of each level.
- private int[] skipInterval;
-
- ///
- /// Number of docs skipped per level.
- private int[] numSkipped;
-
- ///
- /// Doc id of current skip entry per level.
- protected internal int[] m_skipDoc;
-
- ///
- /// Doc id of last read skip entry with docId <= target.
- private int lastDoc;
-
- ///
- /// Child pointer of current skip entry per level.
- private long[] childPointer;
-
- ///
- /// childPointer of last read skip entry with docId <=
- /// target.
- ///
- private long lastChildPointer;
-
- private bool inputIsBuffered;
- private readonly int skipMultiplier;
-
- ///
- /// Creates a {@code MultiLevelSkipListReader}.
- protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval, int skipMultiplier)
- {
- this.skipStream = new IndexInput[maxSkipLevels];
- this.skipPointer = new long[maxSkipLevels];
- this.childPointer = new long[maxSkipLevels];
- this.numSkipped = new int[maxSkipLevels];
- this.m_maxNumberOfSkipLevels = maxSkipLevels;
- this.skipInterval = new int[maxSkipLevels];
- this.skipMultiplier = skipMultiplier;
- this.skipStream[0] = skipStream;
- this.inputIsBuffered = (skipStream is BufferedIndexInput);
- this.skipInterval[0] = skipInterval;
- for (int i = 1; i < maxSkipLevels; i++)
- {
- // cache skip intervals
- this.skipInterval[i] = this.skipInterval[i - 1] * skipMultiplier;
- }
- m_skipDoc = new int[maxSkipLevels];
- }
-
- ///
- /// Creates a {@code MultiLevelSkipListReader}, where
- /// {@code skipInterval} and {@code skipMultiplier} are
- /// the same.
- ///
- protected internal MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval)
- : this(skipStream, maxSkipLevels, skipInterval, skipInterval)
- {
- }
-
- ///
- /// Returns the id of the doc to which the last call of
- /// has skipped.
- ///
- public virtual int Doc
- {
- get
- {
- return lastDoc;
- }
- }
-
- ///
- /// Skips entries to the first beyond the current whose document number is
- /// greater than or equal to target. Returns the current doc count.
- ///
- public virtual int SkipTo(int target)
- {
- if (!haveSkipped)
- {
- // first time, load skip levels
- LoadSkipLevels();
- haveSkipped = true;
- }
-
- // walk up the levels until highest level is found that has a skip
- // for this target
- int level = 0;
- while (level < numberOfSkipLevels - 1 && target > m_skipDoc[level + 1])
- {
- level++;
- }
-
- while (level >= 0)
- {
- if (target > m_skipDoc[level])
- {
- if (!LoadNextSkip(level))
- {
- continue;
- }
- }
- else
- {
- // no more skips on this level, go down one level
- if (level > 0 && lastChildPointer > skipStream[level - 1].GetFilePointer())
- {
- SeekChild(level - 1);
- }
- level--;
- }
- }
-
- return numSkipped[0] - skipInterval[0] - 1;
- }
-
- private bool LoadNextSkip(int level)
- {
- // we have to skip, the target document is greater than the current
- // skip list entry
- SetLastSkipData(level);
-
- numSkipped[level] += skipInterval[level];
-
- if (numSkipped[level] > docCount)
- {
- // this skip list is exhausted
- m_skipDoc[level] = int.MaxValue;
- if (numberOfSkipLevels > level)
- {
- numberOfSkipLevels = level;
- }
- return false;
- }
-
- // read next skip entry
- m_skipDoc[level] += ReadSkipData(level, skipStream[level]);
-
- if (level != 0)
- {
- // read the child pointer if we are not on the leaf level
- childPointer[level] = skipStream[level].ReadVInt64() + skipPointer[level - 1];
- }
-
- return true;
- }
-
- ///
- /// Seeks the skip entry on the given level
- protected virtual void SeekChild(int level)
- {
- skipStream[level].Seek(lastChildPointer);
- numSkipped[level] = numSkipped[level + 1] - skipInterval[level + 1];
- m_skipDoc[level] = lastDoc;
- if (level > 0)
- {
- childPointer[level] = skipStream[level].ReadVInt64() + skipPointer[level - 1];
- }
- }
-
- public void Dispose()
- {
- for (int i = 1; i < skipStream.Length; i++)
- {
- if (skipStream[i] != null)
- {
- skipStream[i].Dispose();
- }
- }
- }
-
- ///
- /// Initializes the reader, for reuse on a new term.
- public virtual void Init(long skipPointer, int df)
- {
- this.skipPointer[0] = skipPointer;
- this.docCount = df;
- Debug.Assert(skipPointer >= 0 && skipPointer <= skipStream[0].Length, "invalid skip pointer: " + skipPointer + ", length=" + skipStream[0].Length);
- Array.Clear(m_skipDoc, 0, m_skipDoc.Length);
- Array.Clear(numSkipped, 0, numSkipped.Length);
- Array.Clear(childPointer, 0, childPointer.Length);
-
- haveSkipped = false;
- for (int i = 1; i < numberOfSkipLevels; i++)
- {
- skipStream[i] = null;
- }
- }
-
- ///
- /// Loads the skip levels
- private void LoadSkipLevels()
- {
- if (docCount <= skipInterval[0])
- {
- numberOfSkipLevels = 1;
- }
- else
- {
- numberOfSkipLevels = 1 + MathUtil.Log(docCount / skipInterval[0], skipMultiplier);
- }
-
- if (numberOfSkipLevels > m_maxNumberOfSkipLevels)
- {
- numberOfSkipLevels = m_maxNumberOfSkipLevels;
- }
-
- skipStream[0].Seek(skipPointer[0]);
-
- int toBuffer = numberOfLevelsToBuffer;
-
- for (int i = numberOfSkipLevels - 1; i > 0; i--)
- {
- // the length of the current level
- long length = skipStream[0].ReadVInt64();
-
- // the start pointer of the current level
- skipPointer[i] = skipStream[0].GetFilePointer();
- if (toBuffer > 0)
- {
- // buffer this level
- skipStream[i] = new SkipBuffer(skipStream[0], (int)length);
- toBuffer--;
- }
- else
- {
- // clone this stream, it is already at the start of the current level
- skipStream[i] = (IndexInput)skipStream[0].Clone();
- if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
- {
- ((BufferedIndexInput)skipStream[i]).SetBufferSize((int)length);
- }
-
- // move base stream beyond the current level
- skipStream[0].Seek(skipStream[0].GetFilePointer() + length);
- }
- }
-
- // use base stream for the lowest level
- skipPointer[0] = skipStream[0].GetFilePointer();
- }
-
- ///
- /// Subclasses must implement the actual skip data encoding in this method.
- ///
- /// the level skip data shall be read from
- /// the skip stream to read from
- protected abstract int ReadSkipData(int level, IndexInput skipStream);
-
- ///
- /// Copies the values of the last read skip entry on this
- protected virtual void SetLastSkipData(int level)
- {
- lastDoc = m_skipDoc[level];
- lastChildPointer = childPointer[level];
- }
-
- ///
- /// used to buffer the top skip levels
- private sealed class SkipBuffer : IndexInput
- {
- private byte[] data;
- private long pointer;
- private int pos;
-
- internal SkipBuffer(IndexInput input, int length)
- : base("SkipBuffer on " + input)
- {
- data = new byte[length];
- pointer = input.GetFilePointer();
- input.ReadBytes(data, 0, length);
- }
-
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- data = null;
- }
- }
-
- public override long GetFilePointer()
- {
- return pointer + pos;
- }
-
- public override long Length
- {
- get { return data.Length; }
- }
-
- public override byte ReadByte()
- {
- return data[pos++];
- }
-
- public override void ReadBytes(byte[] b, int offset, int len)
- {
- Array.Copy(data, pos, b, offset, len);
- pos += len;
- }
-
- public override void Seek(long pos)
- {
- this.pos = (int)(pos - pointer);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/MultiLevelSkipListWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/MultiLevelSkipListWriter.cs b/src/Lucene.Net.Core/Codecs/MultiLevelSkipListWriter.cs
deleted file mode 100644
index d7fe18b..0000000
--- a/src/Lucene.Net.Core/Codecs/MultiLevelSkipListWriter.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-using System.Diagnostics;
-
-namespace Lucene.Net.Codecs
-{
- /*
- * 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.
- */
-
- using IndexOutput = Lucene.Net.Store.IndexOutput;
- using MathUtil = Lucene.Net.Util.MathUtil;
- using RAMOutputStream = Lucene.Net.Store.RAMOutputStream;
-
- ///
- /// this abstract class writes skip lists with multiple levels.
- ///
- ///
- ///
- /// 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.
- ///
- /// @lucene.experimental
- ///
-
- public abstract class MultiLevelSkipListWriter
- {
- ///
- /// number of levels in this skip list
- protected internal int m_numberOfSkipLevels;
-
- ///
- /// the skip interval in the list with level = 0
- private int skipInterval;
-
- ///
- /// skipInterval used for level > 0
- private int skipMultiplier;
-
- ///
- /// for every skip level a different buffer is used
- private RAMOutputStream[] skipBuffer;
-
- ///
- /// Creates a {@code MultiLevelSkipListWriter}.
- protected MultiLevelSkipListWriter(int skipInterval, int skipMultiplier, int maxSkipLevels, int df)
- {
- this.skipInterval = skipInterval;
- this.skipMultiplier = skipMultiplier;
-
- // calculate the maximum number of skip levels for this document frequency
- if (df <= skipInterval)
- {
- m_numberOfSkipLevels = 1;
- }
- else
- {
- m_numberOfSkipLevels = 1 + MathUtil.Log(df / skipInterval, skipMultiplier);
- }
-
- // make sure it does not exceed maxSkipLevels
- if (m_numberOfSkipLevels > maxSkipLevels)
- {
- m_numberOfSkipLevels = maxSkipLevels;
- }
- }
-
- ///
- /// Creates a {@code MultiLevelSkipListWriter}, where
- /// {@code skipInterval} and {@code skipMultiplier} are
- /// the same.
- ///
- protected MultiLevelSkipListWriter(int skipInterval, int maxSkipLevels, int df)
- : this(skipInterval, skipInterval, maxSkipLevels, df)
- {
- }
-
- ///
- /// Allocates internal skip buffers.
- protected virtual void Init()
- {
- skipBuffer = new RAMOutputStream[m_numberOfSkipLevels];
- for (int i = 0; i < m_numberOfSkipLevels; i++)
- {
- skipBuffer[i] = new RAMOutputStream();
- }
- }
-
- ///
- /// Creates new buffers or empties the existing ones
- public virtual void ResetSkip()
- {
- if (skipBuffer == null)
- {
- Init();
- }
- else
- {
- for (int i = 0; i < skipBuffer.Length; i++)
- {
- skipBuffer[i].Reset();
- }
- }
- }
-
- ///
- /// Subclasses must implement the actual skip data encoding in this method.
- ///
- /// the level skip data shall be writing for
- /// the skip buffer to write to
- protected abstract void WriteSkipData(int level, IndexOutput skipBuffer);
-
- ///
- /// Writes the current skip data to the buffers. The current document frequency determines
- /// the max level is skip data is to be written to.
- ///
- /// the current document frequency
- /// If an I/O error occurs
- public virtual void BufferSkip(int df)
- {
- Debug.Assert(df % skipInterval == 0);
- int numLevels = 1;
- df /= skipInterval;
-
- // determine max level
- while ((df % skipMultiplier) == 0 && numLevels < m_numberOfSkipLevels)
- {
- numLevels++;
- df /= skipMultiplier;
- }
-
- long childPointer = 0;
-
- for (int level = 0; level < numLevels; level++)
- {
- WriteSkipData(level, skipBuffer[level]);
-
- long newChildPointer = skipBuffer[level].GetFilePointer();
-
- if (level != 0)
- {
- // store child pointers for all levels except the lowest
- skipBuffer[level].WriteVInt64(childPointer);
- }
-
- //remember the childPointer for the next level
- childPointer = newChildPointer;
- }
- }
-
- ///
- /// Writes the buffered skip lists to the given output.
- ///
- /// the IndexOutput the skip lists shall be written to
- /// the pointer the skip list starts
- public virtual long WriteSkip(IndexOutput output)
- {
- long skipPointer = output.GetFilePointer();
- //System.out.println("skipper.writeSkip fp=" + skipPointer);
- if (skipBuffer == null || skipBuffer.Length == 0)
- {
- return skipPointer;
- }
-
- for (int level = m_numberOfSkipLevels - 1; level > 0; level--)
- {
- long length = skipBuffer[level].GetFilePointer();
- if (length > 0)
- {
- output.WriteVInt64(length);
- skipBuffer[level].WriteTo(output);
- }
- }
- skipBuffer[0].WriteTo(output);
-
- return skipPointer;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Codecs/NormsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/NormsFormat.cs b/src/Lucene.Net.Core/Codecs/NormsFormat.cs
deleted file mode 100644
index 0bb97a9..0000000
--- a/src/Lucene.Net.Core/Codecs/NormsFormat.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-namespace Lucene.Net.Codecs
-{
- /*
- * 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.
- */
-
- using SegmentReadState = Lucene.Net.Index.SegmentReadState;
- using SegmentWriteState = Lucene.Net.Index.SegmentWriteState;
-
- ///
- /// Encodes/decodes per-document score normalization values.
- ///
- public abstract class NormsFormat
- {
- ///
- /// Sole constructor. (For invocation by subclass
- /// constructors, typically implicit.)
- ///
- protected internal NormsFormat()
- {
- }
-
- ///
- /// Returns a to write norms to the
- /// index.
- ///
- public abstract DocValuesConsumer NormsConsumer(SegmentWriteState state);
-
- ///
- /// Returns a to read norms from the index.
- ///
- /// NOTE: by the time this call returns, it must hold open any files it will
- /// need to use; else, those files may be deleted. Additionally, required files
- /// may be deleted during the execution of this call before there is a chance
- /// to open them. Under these circumstances an IOException should be thrown by
- /// the implementation. IOExceptions are expected and will automatically cause
- /// a retry of the segment opening logic with the newly revised segments.
- ///
- public abstract DocValuesProducer NormsProducer(SegmentReadState state);
- }
-}
\ No newline at end of file