lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/11] lucenenet git commit: Lucene.Net.Core.Codecs (Codec + DocValuesFormat + PostingsFormat): Removed commented code that helped with the port.
Date Sat, 25 Mar 2017 06:11:20 GMT
Lucene.Net.Core.Codecs (Codec + DocValuesFormat + PostingsFormat): Removed commented code that
helped with the port.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2fc38819
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2fc38819
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2fc38819

Branch: refs/heads/api-work
Commit: 2fc3881964e499c02a59199ded74821f745f6d67
Parents: c344801
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Mar 25 05:49:29 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sat Mar 25 05:49:29 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Codecs/Codec.cs           | 149 +--------------------
 src/Lucene.Net.Core/Codecs/DocValuesFormat.cs | 112 +---------------
 src/Lucene.Net.Core/Codecs/PostingsFormat.cs  | 115 +---------------
 3 files changed, 7 insertions(+), 369 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fc38819/src/Lucene.Net.Core/Codecs/Codec.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Codec.cs b/src/Lucene.Net.Core/Codecs/Codec.cs
index e50e529..34c083e 100644
--- a/src/Lucene.Net.Core/Codecs/Codec.cs
+++ b/src/Lucene.Net.Core/Codecs/Codec.cs
@@ -56,6 +56,8 @@ namespace Lucene.Net.Codecs
     /// <seealso cref="DefaultCodecFactory"/>
     /// <seealso cref="ICodecFactory"/>
     /// <seealso cref="CodecNameAttribute"/>
+    // LUCENENET specific - refactored this class so it depends on ICodecFactory rather than
+    // the Java-centric NamedSPILoader
     public abstract class Codec //: NamedSPILoader.INamedSPI
     {
         private static ICodecFactory codecFactory;
@@ -196,151 +198,4 @@ namespace Lucene.Net.Codecs
             return name;
         }
     }
-
-    ///// <summary>
-    ///// Encodes/decodes an inverted index segment.
-    ///// <p>
-    ///// Note, when extending this class, the name (<seealso cref="#getName"/>) is
-    ///// written into the index. In order for the segment to be read, the
-    ///// name must resolve to your implementation via <seealso cref="#forName(String)"/>.
-    ///// this method uses Java's
-    ///// <seealso cref="ServiceLoader Service Provider Interface"/> (SPI) to resolve
codec names.
-    ///// <p>
-    ///// If you implement your own codec, make sure that it has a no-arg constructor
-    ///// so SPI can load it. </summary>
-    ///// <seealso cref= ServiceLoader </seealso>
-    //public abstract class Codec : NamedSPILoader.INamedSPI
-    //{
-    //    private static readonly NamedSPILoader<Codec> loader;
-
-    //    private readonly string name;
-
-    //    static Codec()
-    //    {
-    //        loader = new NamedSPILoader<Codec>(typeof(Codec));
-    //        defaultCodec = Codec.ForName("Lucene46");
-    //    }
-
-    //    /// <summary>
-    //    /// Creates a new codec.
-    //    /// <p>
-    //    /// The provided name will be written into the index segment: in order to
-    //    /// for the segment to be read this class should be registered with Java's
-    //    /// SPI mechanism (registered in META-INF/ of your jar file, etc). </summary>
-    //    /// <param name="name"> must be all ascii alphanumeric, and less than 128
characters in length. </param>
-    //    protected internal Codec(string name)
-    //    {
-    //        NamedSPILoader<Codec>.CheckServiceName(name);
-    //        this.name = name;
-    //    }
-
-    //    /// <summary>
-    //    /// Returns this codec's name </summary>
-    //    public string Name
-    //    {
-    //        get
-    //        {
-    //            return name;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// Encodes/decodes postings </summary>
-    //    public abstract PostingsFormat PostingsFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes docvalues </summary>
-    //    public abstract DocValuesFormat DocValuesFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes stored fields </summary>
-    //    public abstract StoredFieldsFormat StoredFieldsFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes term vectors </summary>
-    //    public abstract TermVectorsFormat TermVectorsFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes field infos file </summary>
-    //    public abstract FieldInfosFormat FieldInfosFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes segment info file </summary>
-    //    public abstract SegmentInfoFormat SegmentInfoFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes document normalization values </summary>
-    //    public abstract NormsFormat NormsFormat { get; }
-
-    //    /// <summary>
-    //    /// Encodes/decodes live docs </summary>
-    //    public abstract LiveDocsFormat LiveDocsFormat { get; }
-
-    //    /// <summary>
-    //    /// looks up a codec by name </summary>
-    //    public static Codec ForName(string name)
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called Codec.forName() before
all Codecs could be initialized. " + "this likely happens if you call it from a Codec's ctor.");
-    //        }
-    //        return loader.Lookup(name);
-    //    }
-
-    //    /// <summary>
-    //    /// returns a list of all available codec names </summary>
-    //    public static ISet<string> AvailableCodecs()
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called Codec.AvailableCodecs()
before all Codecs could be initialized. " +
-    //                "this likely happens if you call it from a Codec's ctor.");
-    //        }
-    //        return loader.AvailableServices();
-    //    }
-
-    //    /// <summary>
-    //    /// Reloads the codec list from the given <seealso cref="ClassLoader"/>.
-    //    /// Changes to the codecs are visible after the method ends, all
-    //    /// iterators (<seealso cref="#availableCodecs()"/>,...) stay consistent.
-    //    ///
-    //    /// <p><b>NOTE:</b> Only new codecs are added, existing ones
are
-    //    /// never removed or replaced.
-    //    ///
-    //    /// <p><em>this method is expensive and should only be called for discovery
-    //    /// of new codecs on the given classpath/classloader!</em>
-    //    /// </summary>
-    //    public static void ReloadCodecs()
-    //    {
-    //        loader.Reload();
-    //    }
-
-    //    private static Codec defaultCodec;
-
-    //    /// <summary>
-    //    /// expert: returns the default codec used for newly created
-    //    ///  <seealso cref="IndexWriterConfig"/>s.
-    //    /// </summary>
-    //    // TODO: should we use this, or maybe a system property is better?
-    //    public static Codec Default
-    //    {
-    //        get
-    //        {
-    //            return defaultCodec;
-    //        }
-    //        set
-    //        {
-    //            defaultCodec = value;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// returns the codec's name. Subclasses can override to provide
-    //    /// more detail (such as parameters).
-    //    /// </summary>
-    //    public override string ToString()
-    //    {
-    //        return name;
-    //    }
-    //}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fc38819/src/Lucene.Net.Core/Codecs/DocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/DocValuesFormat.cs b/src/Lucene.Net.Core/Codecs/DocValuesFormat.cs
index dff8dfb..e6f127d 100644
--- a/src/Lucene.Net.Core/Codecs/DocValuesFormat.cs
+++ b/src/Lucene.Net.Core/Codecs/DocValuesFormat.cs
@@ -62,6 +62,8 @@ namespace Lucene.Net.Codecs
     /// <seealso cref="DefaultDocValuesFormatFactory"/>
     /// <seealso cref="IDocValuesFormatFactory"/>
     /// <seealso cref="DocValuesFormatNameAttribute"/>
+    // LUCENENET specific - refactored this class so it depends on IDocValuesFormatFactory
rather than
+    // the Java-centric NamedSPILoader
     public abstract class DocValuesFormat //: NamedSPILoader.INamedSPI
     {
         private static IDocValuesFormatFactory docValuesFormatFactory = new DefaultDocValuesFormatFactory();
@@ -166,114 +168,6 @@ namespace Lucene.Net.Codecs
         }
 
         // LUCENENET specific: Removed the ReloadDocValuesFormats() method because
-        // this goes against the grain of standar DI practices.
+        // this goes against the grain of standard DI practices.
     }
-
-
-    ///// <summary>
-    ///// Encodes/decodes per-document values.
-    ///// <p>
-    ///// Note, when extending this class, the name (<seealso cref="#getName"/>) may
-    ///// written into the index in certain configurations. In order for the segment
-    ///// to be read, the name must resolve to your implementation via <seealso cref="#forName(String)"/>.
-    ///// this method uses Java's
-    ///// <seealso cref="ServiceLoader Service Provider Interface"/> (SPI) to resolve
format names.
-    ///// <p>
-    ///// If you implement your own format, make sure that it has a no-arg constructor
-    ///// so SPI can load it. </summary>
-    ///// <seealso cref= ServiceLoader
-    ///// @lucene.experimental  </seealso>
-    //public abstract class DocValuesFormat : NamedSPILoader.INamedSPI
-    //{
-    //    private static readonly NamedSPILoader<DocValuesFormat> loader = new NamedSPILoader<DocValuesFormat>(typeof(DocValuesFormat));
-
-    //    /// <summary>
-    //    /// Unique name that's used to retrieve this format when
-    //    ///  reading the index.
-    //    /// </summary>
-    //    private readonly string name;
-
-    //    /// <summary>
-    //    /// Creates a new docvalues format.
-    //    /// <p>
-    //    /// The provided name will be written into the index segment in some configurations
-    //    /// (such as when using {@code PerFieldDocValuesFormat}): in such configurations,
-    //    /// for the segment to be read this class should be registered with Java's
-    //    /// SPI mechanism (registered in META-INF/ of your jar file, etc). </summary>
-    //    /// <param name="name"> must be all ascii alphanumeric, and less than 128
characters in length. </param>
-    //    protected internal DocValuesFormat(string name)
-    //    {
-    //        NamedSPILoader<DocValuesFormat>.CheckServiceName(name);
-    //        this.name = name;
-    //    }
-
-    //    /// <summary>
-    //    /// Returns a <seealso cref="DocValuesConsumer"/> to write docvalues to the
-    //    ///  index.
-    //    /// </summary>
-    //    public abstract DocValuesConsumer FieldsConsumer(SegmentWriteState state);
-
-    //    /// <summary>
-    //    /// Returns a <seealso cref="DocValuesProducer"/> to read docvalues from
the index.
-    //    /// <p>
-    //    /// 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.
-    //    /// </summary>
-    //    public abstract DocValuesProducer FieldsProducer(SegmentReadState state);
-
-    //    public string Name
-    //    {
-    //        get
-    //        {
-    //            return name;
-    //        }
-    //    }
-
-    //    public override string ToString()
-    //    {
-    //        return "DocValuesFormat(name=" + name + ")";
-    //    }
-
-    //    /// <summary>
-    //    /// looks up a format by name </summary>
-    //    public static DocValuesFormat ForName(string name)
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called DocValuesFormat.forName()
before all formats could be initialized. " + "this likely happens if you call it from a DocValuesFormat's
ctor.");
-    //        }
-    //        return loader.Lookup(name);
-    //    }
-
-    //    /// <summary>
-    //    /// returns a list of all available format names </summary>
-    //    public static ISet<string> AvailableDocValuesFormats()
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called DocValuesFormat.availableDocValuesFormats()
before all formats could be initialized. " + "this likely happens if you call it from a DocValuesFormat's
ctor.");
-    //        }
-    //        return loader.AvailableServices();
-    //    }
-
-    //    /// <summary>
-    //    /// Reloads the DocValues format list from the given <seealso cref="ClassLoader"/>.
-    //    /// Changes to the docvalues formats are visible after the method ends, all
-    //    /// iterators (<seealso cref="#availableDocValuesFormats()"/>,...) stay consistent.
-    //    ///
-    //    /// <p><b>NOTE:</b> Only new docvalues formats are added, existing
ones are
-    //    /// never removed or replaced.
-    //    ///
-    //    /// <p><em>this method is expensive and should only be called for discovery
-    //    /// of new docvalues formats on the given classpath/classloader!</em>
-    //    /// </summary>
-    //    public static void ReloadDocValuesFormats()
-    //    {
-    //        loader.Reload();
-    //    }
-    //}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2fc38819/src/Lucene.Net.Core/Codecs/PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/PostingsFormat.cs b/src/Lucene.Net.Core/Codecs/PostingsFormat.cs
index 71c7169..c4bdd88 100644
--- a/src/Lucene.Net.Core/Codecs/PostingsFormat.cs
+++ b/src/Lucene.Net.Core/Codecs/PostingsFormat.cs
@@ -60,6 +60,8 @@ namespace Lucene.Net.Codecs
     /// <seealso cref="DefaultPostingsFormatFactory"/>
     /// <seealso cref="IPostingsFormatFactory"/>
     /// <seealso cref="PostingsFormatNameAttribute"/>
+    // LUCENENET specific - refactored this class so it depends on IPostingsFormatFactory
rather than
+    // the Java-centric NamedSPILoader
     public abstract class PostingsFormat //: NamedSPILoader.INamedSPI
     {
         private static IPostingsFormatFactory postingsFormatFactory = new DefaultPostingsFormatFactory();
@@ -164,117 +166,4 @@ namespace Lucene.Net.Codecs
         // LUCENENET specific: Removed the ReloadPostingsFormats() method because
         // this goes against the grain of standard DI practices.
     }
-
-
-    ///// <summary>
-    ///// Encodes/decodes terms, postings, and proximity data.
-    ///// <p>
-    ///// Note, when extending this class, the name (<seealso cref="#getName"/>) may
-    ///// written into the index in certain configurations. In order for the segment
-    ///// to be read, the name must resolve to your implementation via <seealso cref="#forName(String)"/>.
-    ///// this method uses Java's
-    ///// <seealso cref="ServiceLoader Service Provider Interface"/> (SPI) to resolve
format names.
-    ///// <p>
-    ///// If you implement your own format, make sure that it has a no-arg constructor
-    ///// so SPI can load it. </summary>
-    ///// <seealso cref= ServiceLoader
-    ///// @lucene.experimental  </seealso>
-    //public abstract class PostingsFormat : NamedSPILoader.INamedSPI
-    //{
-    //    private static readonly NamedSPILoader<PostingsFormat> loader = new NamedSPILoader<PostingsFormat>(typeof(PostingsFormat));
-
-    //    /// <summary>
-    //    /// Zero-length {@code PostingsFormat} array. </summary>
-    //    public static readonly PostingsFormat[] EMPTY = new PostingsFormat[0];
-
-    //    /// <summary>
-    //    /// Unique name that's used to retrieve this format when
-    //    ///  reading the index.
-    //    /// </summary>
-    //    private readonly string name;
-
-    //    /// <summary>
-    //    /// Creates a new postings format.
-    //    /// <p>
-    //    /// The provided name will be written into the index segment in some configurations
-    //    /// (such as when using <seealso cref="PerFieldPostingsFormat"/>): in such
configurations,
-    //    /// for the segment to be read this class should be registered with Java's
-    //    /// SPI mechanism (registered in META-INF/ of your jar file, etc). </summary>
-    //    /// <param name="name"> must be all ascii alphanumeric, and less than 128
characters in length. </param>
-    //    protected PostingsFormat(string name)
-    //    {
-    //        NamedSPILoader<PostingsFormat>.CheckServiceName(name);
-    //        this.name = name;
-    //    }
-
-    //    /// <summary>
-    //    /// Returns this posting format's name </summary>
-    //    public string Name
-    //    {
-    //        get
-    //        {
-    //            return name;
-    //        }
-    //    }
-
-    //    /// <summary>
-    //    /// Writes a new segment </summary>
-    //    public abstract FieldsConsumer FieldsConsumer(SegmentWriteState state);
-
-    //    /// <summary>
-    //    /// Reads a segment.  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.
-    //    ///
-    //    /// </summary>
-    //    public abstract FieldsProducer FieldsProducer(SegmentReadState state);
-
-    //    public override string ToString()
-    //    {
-    //        return "PostingsFormat(name=" + name + ")";
-    //    }
-
-    //    /// <summary>
-    //    /// looks up a format by name </summary>
-    //    public static PostingsFormat ForName(string name)
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called PostingsFormat.forName()
before all formats could be initialized. " + "this likely happens if you call it from a PostingsFormat's
ctor.");
-    //        }
-    //        return loader.Lookup(name);
-    //    }
-
-    //    /// <summary>
-    //    /// returns a list of all available format names </summary>
-    //    public static ISet<string> AvailablePostingsFormats()
-    //    {
-    //        if (loader == null)
-    //        {
-    //            throw new InvalidOperationException("You called PostingsFormat.availablePostingsFormats()
before all formats could be initialized. " + "this likely happens if you call it from a PostingsFormat's
ctor.");
-    //        }
-    //        return loader.AvailableServices();
-    //    }
-
-    //    /// <summary>
-    //    /// Reloads the postings format list from the given <seealso cref="ClassLoader"/>.
-    //    /// Changes to the postings formats are visible after the method ends, all
-    //    /// iterators (<seealso cref="#availablePostingsFormats()"/>,...) stay consistent.
-    //    ///
-    //    /// <p><b>NOTE:</b> Only new postings formats are added, existing
ones are
-    //    /// never removed or replaced.
-    //    ///
-    //    /// <p><em>this method is expensive and should only be called for discovery
-    //    /// of new postings formats on the given classpath/classloader!</em>
-    //    /// </summary>
-    //    public static void ReloadPostingsFormats()
-    //    {
-    //        loader.Reload();
-    //    }
-    //}
 }
\ No newline at end of file


Mime
View raw message