diff --git a/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs b/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs index 83fd993eec..c6f222290c 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs @@ -20,6 +20,15 @@ namespace Lucene.Net.Analysis.Ja.Util * limitations under the License. */ + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// analysis kuromoji-build-dictionary. + /// public static class DictionaryBuilder // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { public enum DictionaryFormat { IPADIC, UNIDIC }; @@ -62,6 +71,15 @@ ConnectionCostsWriter connectionCosts Console.WriteLine("done"); } + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// analysis kuromoji-build-dictionary. + /// public static void Main(string[] args) { DictionaryFormat format; diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs index a42b1f5381..d7790b475d 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/Compile.cs @@ -66,6 +66,14 @@ namespace Egothor.Stemmer { /// /// The Compile class is used to compile a stemmer table. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// analysis stempel-compile-stems /// public static class Compile // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { @@ -75,11 +83,19 @@ public static class Compile // LUCENENET specific: CA1052 Static holder types sh /// /// Entry point to the Compile application. - /// + /// /// This program takes any number of arguments: the first is the name of the /// desired stemming algorithm to use (a list is available in the package /// description) , all of the rest should be the path or paths to a file or /// files containing a stemmer table to compile. + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// analysis stempel-compile-stems /// /// the command line arguments public static void Main(string[] args) diff --git a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs index 9a48e1c9df..f1053e94af 100644 --- a/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs +++ b/src/Lucene.Net.Analysis.Stempel/Egothor.Stemmer/DiffIt.cs @@ -67,6 +67,14 @@ namespace Egothor.Stemmer /// /// The DiffIt class is a means generate patch commands from an already prepared /// stemmer table. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// analysis stempel-patch-stems /// public static class DiffIt // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { @@ -83,11 +91,18 @@ internal static int Get(int i, string s) /// /// Entry point to the DiffIt application. - /// + /// /// This application takes one argument, the path to a file containing a /// stemmer table. The program reads the file and generates the patch commands /// for the stems. - /// + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// analysis stempel-patch-stems /// /// the path to a file containing a stemmer table public static void Main(string[] args) diff --git a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs index 6b0b7a904c..8f04e2fda1 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs @@ -98,6 +98,14 @@ public virtual void Execute() /// /// Run the benchmark algorithm. + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark /// /// Benchmark config and algorithm files. public static void Main(string[] args) @@ -120,7 +128,7 @@ public static void Exec(string[] args) //Environment.Exit(1); } - // verify input files + // verify input files FileInfo algFile = new FileInfo(args[0]); if (!algFile.Exists /*|| !algFile.isFile() ||!algFile.canRead()*/ ) { diff --git a/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs b/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs index 7f0078fc40..1e7500faa8 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Programmatic/Sample.cs @@ -24,9 +24,28 @@ namespace Lucene.Net.Benchmarks.ByTask.Programmatic /// /// Sample performance test written programmatically - no algorithm file is needed here. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// benchmark sample /// public static class Sample // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark sample + /// + /// The command line arguments [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Sample shows optional args[] parameter")] public static void Main(string[] args) { diff --git a/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs b/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs index ca045a42e7..482c6130a2 100644 --- a/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs +++ b/src/Lucene.Net.Benchmark/Quality/Trec/QueryDriver.cs @@ -31,9 +31,28 @@ namespace Lucene.Net.Benchmarks.Quality.Trec /// /// Command-line tool for doing a TREC evaluation run. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// benchmark run-trec-eval /// public static class QueryDriver // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark run-trec-eval + /// + /// Must contain 4 or 5 values + /// Thrown if the incorrect number of arguments are provided. public static void Main(string[] args) { if (args.Length < 4 || args.Length > 5) diff --git a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs index 1592d17346..62f23ec399 100644 --- a/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs +++ b/src/Lucene.Net.Benchmark/Quality/Utils/QualityQueriesFinder.cs @@ -27,6 +27,14 @@ namespace Lucene.Net.Benchmarks.Quality.Utils /// /// Suggest Quality queries based on an index contents. /// Utility class, used for making quality test benchmarks. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// benchmark find-quality-queries /// public class QualityQueriesFinder { @@ -43,7 +51,13 @@ private QualityQueriesFinder(Store.Directory dir) } /// - /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark find-quality-queries /// /// {index-dir} /// if cannot access the index. diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs index b34c36cbaa..be1f79aa2f 100644 --- a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs +++ b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs @@ -132,6 +132,16 @@ protected virtual void ExtractFile(FileInfo sgmFile) } } + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark extract-reuters + /// + /// The command line arguments public static void Main(string[] args) { if (args.Length != 2) diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs b/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs index e81f6cf942..d25bceb2f4 100644 --- a/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs +++ b/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs @@ -118,6 +118,16 @@ public virtual void Extract() Console.WriteLine("Extraction took " + (finish - start) + " ms"); } + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// benchmark extract-wikipedia + /// + /// The command line arguments public static void Main(string[] args) { diff --git a/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs b/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs index e8ac0b1541..8fda2e5764 100644 --- a/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs @@ -43,8 +43,8 @@ public class AssociationsFacetsExample /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -158,6 +158,7 @@ public FacetResult RunDrillDown() /// Runs the sum int/float associations examples and prints the results. + /// The command line arguments [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Demo shows use of optional args argument")] public static void Main(string[] args) { diff --git a/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs b/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs index 4a8d7f851a..ba05f0e3bc 100644 --- a/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs @@ -50,8 +50,8 @@ public sealed class DistanceFacetsExample : IDisposable /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -264,6 +264,7 @@ public void Dispose() } /// Runs the search and drill-down examples and prints the results. + /// The command line arguments public static void Main(string[] args) { using DistanceFacetsExample example = new DistanceFacetsExample(); diff --git a/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs b/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs index 514dfc26f7..b2c752d0b0 100644 --- a/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs @@ -44,8 +44,8 @@ public class ExpressionAggregationFacetsExample /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -116,6 +116,7 @@ public FacetResult RunSearch() } /// Runs the search and drill-down examples and prints the results. + /// The command line arguments public static void Main(string[] args) { Console.WriteLine("Facet counting example:"); diff --git a/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs b/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs index 656d5570d0..b32fe3761e 100644 --- a/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs @@ -42,8 +42,8 @@ public class MultiCategoryListsFacetsExample /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -135,6 +135,7 @@ public IList RunSearch() } /// Runs the search example and prints the results. + /// The command line arguments public static void Main(string[] args) { Console.WriteLine("Facet counting over multiple category lists example:"); diff --git a/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs b/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs index a5c1d263d6..8e05b7b68b 100644 --- a/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs @@ -40,8 +40,8 @@ public sealed class RangeFacetsExample : IDisposable /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -126,6 +126,7 @@ public void Dispose() } /// Runs the search and drill-down examples and prints the results. + /// The command line arguments public static void Main(string[] args) { using RangeFacetsExample example = new RangeFacetsExample(); diff --git a/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs b/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs index 9f591e3e36..b4c1c0c6d7 100644 --- a/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs @@ -42,8 +42,8 @@ public class SimpleFacetsExample /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -234,6 +234,7 @@ public IList RunDrillSideways() } /// Runs the search and drill-down examples and prints the results. + /// The command line arguments public static void Main(string[] args) { Console.WriteLine("Facet counting example:"); diff --git a/src/Lucene.Net.Demo/Facet/SimpleSortedSetFacetsExample.cs b/src/Lucene.Net.Demo/Facet/SimpleSortedSetFacetsExample.cs index b787015378..000fcba064 100644 --- a/src/Lucene.Net.Demo/Facet/SimpleSortedSetFacetsExample.cs +++ b/src/Lucene.Net.Demo/Facet/SimpleSortedSetFacetsExample.cs @@ -35,7 +35,7 @@ namespace Lucene.Net.Demo.Facet { /// /// Shows simple usage of faceted indexing and search - /// using and + /// using and /// . /// public class SimpleSortedSetFacetsExample @@ -43,8 +43,8 @@ public class SimpleSortedSetFacetsExample /// /// Using a constant for all functionality related to a specific index /// is the best strategy. This allows you to upgrade Lucene.Net first - /// and plan the upgrade of the index binary format for a later time. - /// Once the index is upgraded, you simply need to update the constant + /// and plan the upgrade of the index binary format for a later time. + /// Once the index is upgraded, you simply need to update the constant /// version and redeploy your application. /// private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48; @@ -152,6 +152,7 @@ public FacetResult RunDrillDown() } /// Runs the search and drill-down examples and prints the results. + /// The command line arguments public static void Main(string[] args) { Console.WriteLine("Facet counting example:"); diff --git a/src/Lucene.Net.Demo/IndexFiles.cs b/src/Lucene.Net.Demo/IndexFiles.cs index efae0eb4bd..ba3173c99d 100644 --- a/src/Lucene.Net.Demo/IndexFiles.cs +++ b/src/Lucene.Net.Demo/IndexFiles.cs @@ -35,23 +35,23 @@ namespace Lucene.Net.Demo /// Index all text files under a directory. /// /// This is a command-line application demonstrating simple Lucene indexing. - /// Run it with no command-line arguments for usage information. /// public static class IndexFiles // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { /// Index all text files under a directory. + /// The command line arguments public static void Main(string[] args) { // The should be the assembly name of the application // this code is compiled into. In .NET Framework, it is the name of the EXE file. - // In .NET Core, you have the option of compiling this into either an EXE or a DLL + // In .NET Core, you have the option of compiling this into either an EXE or a DLL // (see https://docs.microsoft.com/en-us/dotnet/core/deploying/index). // In the latter case, the will be "dotnet .dll". string usage = "Usage: " + "[-u|--update]\n\n" + "This indexes the documents in , creating a Lucene index" + "in that can be searched with the search-files demo."; - + // Validate required arguments are present. // If not, show usage information. if (args.Length < 2) @@ -130,15 +130,15 @@ public static void Main(string[] args) } /// - /// Recurses over files and directories found under the + /// Recurses over files and directories found under the /// given directory and indexes each file. - /// - /// NOTE: This method indexes one document per input file. - /// This is slow. For good throughput, put multiple documents + /// + /// NOTE: This method indexes one document per input file. + /// This is slow. For good throughput, put multiple documents /// into your input file(s). /// /// - /// to the index where the given + /// to the index where the given /// file/dir info will be stored /// /// @@ -163,7 +163,7 @@ internal static void IndexDocs(IndexWriter writer, DirectoryInfo directoryInfo) /// Indexes the given file using the given writer. /// /// - /// to the index where the given + /// to the index where the given /// file info will be stored. /// /// @@ -179,7 +179,7 @@ internal static void IndexDocs(IndexWriter writer, FileInfo file) Document doc = new Document(); // Add the path of the file as a field named "path". Use a - // field that is indexed (i.e. searchable), but don't tokenize + // field that is indexed (i.e. searchable), but don't tokenize // the field into separate words and don't index term frequency // or positional information: Field pathField = new StringField("path", file.FullName, Field.Store.YES); @@ -208,8 +208,8 @@ internal static void IndexDocs(IndexWriter writer, FileInfo file) } else { - // Existing index (an old copy of this document may have been indexed) so - // we use updateDocument instead to replace the old one matching the exact + // Existing index (an old copy of this document may have been indexed) so + // we use updateDocument instead to replace the old one matching the exact // path, if present: Console.WriteLine("updating " + file); writer.UpdateDocument(new Term("path", file.FullName), doc); diff --git a/src/Lucene.Net.Demo/SearchFiles.cs b/src/Lucene.Net.Demo/SearchFiles.cs index a8267af1a3..b001396bfe 100644 --- a/src/Lucene.Net.Demo/SearchFiles.cs +++ b/src/Lucene.Net.Demo/SearchFiles.cs @@ -41,11 +41,12 @@ namespace Lucene.Net.Demo public static class SearchFiles // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { /// Simple command-line based search demo. + /// The command line arguments public static void Main(string[] args) { // The should be the assembly name of the application // this code is compiled into. In .NET Framework, it is the name of the EXE file. - // In .NET Core, you have the option of compiling this into either a DLL or an EXE + // In .NET Core, you have the option of compiling this into either a DLL or an EXE // (see https://docs.microsoft.com/en-us/dotnet/core/deploying/index). // In the first case, the will be "dotnet .dll". string usage = "Usage: [-f|--field ] " + @@ -53,7 +54,7 @@ public static void Main(string[] args) "[--raw] [-p|--page-size ]\n\n" + "Use no --query or --queries-file option for interactive mode.\n\n" + "See http://lucene.apache.org/core/4_8_0/demo/ for details."; - if (args.Length < 1 || args.Length > 0 && + if (args.Length < 1 || args.Length > 0 && ("?".Equals(args[0], StringComparison.Ordinal) || "-h".Equals(args[0], StringComparison.Ordinal) || "--help".Equals(args[0], StringComparison.Ordinal))) { Console.WriteLine(usage); @@ -167,7 +168,7 @@ public static void Main(string[] args) } /// - /// This demonstrates a typical paging search scenario, where the search engine presents + /// This demonstrates a typical paging search scenario, where the search engine presents /// pages of size n to the user. The user can then go to the next page if interested in /// the next hits. /// @@ -209,7 +210,7 @@ public static void DoPagingSearch(IndexSearcher searcher, Query query, for (int i = start; i < end; i++) { if (raw) // output raw format - { + { Console.WriteLine("doc=" + hits[i].Doc + " score=" + hits[i].Score); continue; } diff --git a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs index c0bed26c55..514bfdcf59 100644 --- a/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs +++ b/src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs @@ -25,6 +25,14 @@ namespace Lucene.Net.Index /// /// Command-line tool for extracting sub-files out of a compound file. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with two commands that map to that method: + /// index extract-cfs and index list-cfs /// public static class CompoundFileExtractor // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { @@ -32,8 +40,17 @@ public static class CompoundFileExtractor // LUCENENET specific: CA1052 Static h /// Prints the filename and size of each file within a given compound file. /// Add the -extract flag to extract files to the current working directory. /// In order to make the extracted version of the index work, you have to copy - /// the segments file from the compound index into the directory where the extracted files are stored. - ///// Usage: org.apache.lucene.index.IndexReader [-extract] <cfsfile> + /// the segments file from the compound index into the directory where the extracted files are stored. + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with two commands that map to this method: + /// index extract-cfs and index list-cfs + /// + /// The command line arguments public static void Main(string[] args) { string filename = null; @@ -151,4 +168,4 @@ public static void Main(string[] args) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Index/IndexSplitter.cs b/src/Lucene.Net.Misc/Index/IndexSplitter.cs index 3d02492400..1d6e409ece 100644 --- a/src/Lucene.Net.Misc/Index/IndexSplitter.cs +++ b/src/Lucene.Net.Misc/Index/IndexSplitter.cs @@ -29,18 +29,27 @@ namespace Lucene.Net.Index /// Command-line tool that enables listing segments in an /// index, copying specific segments to another index, and /// deleting segments from an index. - /// - /// This tool does file-level copying of segments files. + /// + /// + /// This tool does file-level copying of segments files. /// This means it's unable to split apart a single segment /// into multiple segments. For example if your index is a /// single segment, this tool won't help. Also, it does basic /// file-level copying (using simple /// Stream) so it will not work with non - /// FSDirectory Directory impls. - /// + /// FSDirectory Directory impls. + /// /// @lucene.experimental You can easily /// accidentally remove segments from your index so be /// careful! + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with three commands that map to that method: + /// index copy-segments, index delete-segments, and index list-segments /// public class IndexSplitter { @@ -50,6 +59,16 @@ public class IndexSplitter internal DirectoryInfo dir; + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with three commands that map to this method: + /// index copy-segments, index delete-segments, and index list-segments + /// + /// The command line arguments public static void Main(string[] args) { if (args.Length < 2) @@ -179,4 +198,4 @@ private static void CopyFile(FileInfo src, FileInfo dst) @in.CopyTo(@out); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs index 30fe0d7ea1..98c2900866 100644 --- a/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs +++ b/src/Lucene.Net.Misc/Index/MultiPassIndexSplitter.cs @@ -33,19 +33,18 @@ namespace Lucene.Net.Index /// here uses where the input data /// comes from the input index with artificially applied deletes to the document /// id-s that fall outside the selected partition. - /// Note 1: Deletes are only applied to a buffered list of deleted docs and + /// + /// Note 1: Deletes are only applied to a buffered list of deleted docs and /// don't affect the source index - this tool works also with read-only indexes. - /// - /// Note 2: the disadvantage of this tool is that source index needs to be + /// + /// Note 2: the disadvantage of this tool is that source index needs to be /// read as many times as there are parts to be created, hence the name of this /// tool. - /// - /// - /// NOTE: this tool is unaware of documents added - /// atomically via or + /// + /// NOTE: this tool is unaware of documents added + /// atomically via or /// , which means it can easily /// break up such document groups. - /// /// public class MultiPassIndexSplitter { @@ -120,6 +119,18 @@ public virtual void Split(LuceneVersion version, IndexReader @in, Store.Director Console.Error.WriteLine("Done."); } + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index split + /// + /// + /// public static void Main(string[] args) { if (args.Length < 5) @@ -318,4 +329,4 @@ public void DeleteDocument(int n) public override IBits LiveDocs => liveDocs; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs index fb7fd1e84e..1e5710ebf2 100644 --- a/src/Lucene.Net.Misc/Misc/GetTermInfo.cs +++ b/src/Lucene.Net.Misc/Misc/GetTermInfo.cs @@ -24,10 +24,30 @@ namespace Lucene.Net.Misc */ /// - /// Utility to get document frequency and total number of occurrences (sum of the tf for each doc) of a term. + /// Utility to get document frequency and total number of occurrences (sum of the tf for each doc) of a term. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// index list-term-info /// public static class GetTermInfo // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index list-term-info + /// + /// The command line arguments + /// Thrown if the incorrect number of arguments are provided public static void Main(string[] args) { @@ -64,4 +84,4 @@ public static void TermInfo(Store.Directory dir, Term term) // Console.WriteLine("\n\nusage:\n\t" + "java " + typeof(GetTermInfo).FullName + " field term \n\n"); //} } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs index 1153f1f21f..990f459dda 100644 --- a/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs +++ b/src/Lucene.Net.Misc/Misc/HighFreqTerms.cs @@ -27,21 +27,39 @@ namespace Lucene.Net.Misc * limitations under the License. */ + // LUCENENET: Not used + // If the -t flag is given, both document frequency and total tf (total + // number of occurrences) are reported, ordered by descending total tf. + /// /// class extracts the top n most frequent terms /// (by document frequency) from an existing Lucene index and reports their /// document frequency. - /// - /// If the -t flag is given, both document frequency and total tf (total - /// number of occurrences) are reported, ordered by descending total tf. - /// - /// + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// index list-high-freq-terms /// public static class HighFreqTerms // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { // The top numTerms will be displayed public const int DEFAULT_NUMTERMS = 100; + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index list-high-freq-terms + /// + /// + /// public static void Main(string[] args) { string field = null; @@ -81,7 +99,7 @@ public static void Main(string[] args) } } - // LUCENENET specific - our wrapper console shows the correct usage + // LUCENENET specific - The lucene-cli docs show the correct usage //private static void Usage() //{ // Console.WriteLine("\n\n" + "java org.apache.lucene.misc.HighFreqTerms [-t] [number_terms] [field]\n\t -t: order by totalTermFreq\n\n"); @@ -156,7 +174,7 @@ public int Compare(TermStats a, TermStats b) res = a.Field.CompareToOrdinal(b.Field); if (res == 0) { - res = a.termtext.CompareTo(b.termtext); + res = a.TermText.CompareTo(b.TermText); } } return res; @@ -164,7 +182,7 @@ public int Compare(TermStats a, TermStats b) } /// - /// Compares terms by + /// Compares terms by /// public sealed class TotalTermFreqComparer : IComparer { @@ -180,7 +198,7 @@ public int Compare(TermStats a, TermStats b) res = a.Field.CompareToOrdinal(b.Field); if (res == 0) { - res = a.termtext.CompareTo(b.termtext); + res = a.TermText.CompareTo(b.TermText); } } return res; @@ -189,14 +207,14 @@ public int Compare(TermStats a, TermStats b) /// /// Priority queue for objects - /// + /// /// internal sealed class TermStatsQueue : PriorityQueue { internal readonly IComparer comparer; #nullable enable - internal TermStatsQueue(int size, IComparer comparer) + internal TermStatsQueue(int size, IComparer comparer) : base(size) { this.comparer = comparer ?? throw new ArgumentNullException(nameof(comparer)); // LUCENENET: Added null guard clause @@ -217,4 +235,4 @@ internal void Fill(string field, TermsEnum termsEnum) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs b/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs index defd30841e..2208599e62 100644 --- a/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs +++ b/src/Lucene.Net.Misc/Misc/IndexMergeTool.cs @@ -26,9 +26,29 @@ namespace Lucene.Net.Misc /// /// Merges indices specified on the command line into the index /// specified as the first command line argument. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// index merge /// public static class IndexMergeTool // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index merge + /// + /// The command line arguments + /// Thrown if the incorrect number of arguments are provided public static void Main(string[] args) { if (args.Length < 3) @@ -68,4 +88,4 @@ public static void Main(string[] args) Console.WriteLine("Done."); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Misc/Misc/TermStats.cs b/src/Lucene.Net.Misc/Misc/TermStats.cs index 18ec5942f1..7ac5fbc918 100644 --- a/src/Lucene.Net.Misc/Misc/TermStats.cs +++ b/src/Lucene.Net.Misc/Misc/TermStats.cs @@ -25,14 +25,14 @@ namespace Lucene.Net.Misc /// public sealed class TermStats { - internal readonly BytesRef termtext; + public BytesRef TermText { get; private set; } public string Field { get; set; } public int DocFreq { get; set; } public long TotalTermFreq { get; set; } internal TermStats(string field, BytesRef termtext, int df, long tf) { - this.termtext = BytesRef.DeepCopyOf(termtext); + this.TermText = BytesRef.DeepCopyOf(termtext); this.Field = field; this.DocFreq = df; this.TotalTermFreq = tf; @@ -40,12 +40,12 @@ internal TermStats(string field, BytesRef termtext, int df, long tf) internal string GetTermText() { - return termtext.Utf8ToString(); + return TermText.Utf8ToString(); } public override string ToString() { - return ("TermStats: Term=" + termtext.Utf8ToString() + " DocFreq=" + DocFreq + " TotalTermFreq=" + TotalTermFreq); + return ("TermStats: Term=" + TermText.Utf8ToString() + " DocFreq=" + DocFreq + " TotalTermFreq=" + TotalTermFreq); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs index 5c72489854..65ab7d4e14 100644 --- a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs +++ b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs @@ -122,7 +122,7 @@ public void TestGetHighFreqTerms() for (int i = 0; i < terms.Length; i++) { - string termtext = terms[i].termtext.Utf8ToString(); + string termtext = terms[i].TermText.Utf8ToString(); // hardcoded highTF or highTFmedDF if (termtext.Contains("highTF")) { @@ -195,7 +195,7 @@ public void TestGetTermFreqOrdered() for (int i = 0; i < terms.Length; i++) { - string text = terms[i].termtext.Utf8ToString(); + string text = terms[i].TermText.Utf8ToString(); if (text.Contains("highTF")) { if (text.Contains("medDF")) diff --git a/src/Lucene.Net/Index/CheckIndex.cs b/src/Lucene.Net/Index/CheckIndex.cs index 68c15734a7..31084de387 100644 --- a/src/Lucene.Net/Index/CheckIndex.cs +++ b/src/Lucene.Net/Index/CheckIndex.cs @@ -107,7 +107,7 @@ internal Status() /// /// Empty unless you passed specific segments list to check as optional 3rd argument. /// - public IList SegmentsChecked { get; internal set; } // LUCENENET specific - made setter internal + public IList SegmentsChecked { get; internal set; } // LUCENENET specific - made setter internal /// /// True if the index was created with a newer version of Lucene than the tool. @@ -137,7 +137,7 @@ internal Status() public int NumBadSegments { get; internal set; } // LUCENENET specific - made setter internal /// - /// True if we checked only specific segments + /// True if we checked only specific segments /// ( was called with non-null /// argument). /// @@ -519,13 +519,13 @@ public virtual Status DoCheckIndex(IList onlySegments) { Msg(infoStream, "ERROR: could not read any segments file in directory"); result.MissingSegments = true; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(t.ToString()); //infoStream.WriteLine(t.StackTrace); - + return result; } @@ -567,13 +567,13 @@ public virtual Status DoCheckIndex(IList onlySegments) catch (Exception t) when (t.IsThrowable()) { Msg(infoStream, "ERROR: could not open segments file in directory"); - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(t.ToString()); //infoStream.WriteLine(t.StackTrace); - + result.CantOpenSegments = true; return result; } @@ -585,13 +585,13 @@ public virtual Status DoCheckIndex(IList onlySegments) catch (Exception t) when (t.IsThrowable()) { Msg(infoStream, "ERROR: could not read segment file version in directory"); - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(t.ToString()); //infoStream.WriteLine(t.StackTrace); - + result.MissingSegmentVersion = true; return result; } @@ -745,12 +745,12 @@ public virtual Status DoCheckIndex(IList onlySegments) segInfoStat.OpenReaderPassed = true; infoStream?.Write(" test: check integrity....."); - + reader.CheckIntegrity(); Msg(infoStream, "OK"); infoStream?.Write(" test: check live docs....."); - + int numDocs = reader.NumDocs; toLoseDocCount = numDocs; if (reader.HasDeletions) @@ -818,7 +818,7 @@ public virtual Status DoCheckIndex(IList onlySegments) // Test getFieldInfos() infoStream?.Write(" test: fields.............."); - + FieldInfos fieldInfos = reader.FieldInfos; Msg(infoStream, "OK [" + fieldInfos.Count + " fields]"); segInfoStat.NumFields = fieldInfos.Count; @@ -873,7 +873,7 @@ public virtual Status DoCheckIndex(IList onlySegments) // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(t.ToString()); - + Msg(infoStream, ""); result.TotLoseDocCount += toLoseDocCount; result.NumBadSegments++; @@ -954,12 +954,12 @@ public static Status.FieldNormStatus TestFieldNorms(AtomicReader reader, TextWri { Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + //infoStream.WriteLine(e.StackTrace); } return status; @@ -1645,7 +1645,7 @@ public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWrite try { infoStream?.Write(" test: terms, freq, prox..."); - + Fields fields = reader.Fields; FieldInfos fieldInfos = reader.FieldInfos; status = CheckFields(fields, liveDocs, maxDoc, fieldInfos, true, false, infoStream, verbose); @@ -1660,12 +1660,12 @@ public static Status.TermIndexStatus TestPostings(AtomicReader reader, TextWrite Msg(infoStream, "ERROR: " + e); status = new Status.TermIndexStatus(); status.Error = e; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + //infoStream.WriteLine(e.StackTrace); } return status; @@ -1710,12 +1710,12 @@ public static Status.StoredFieldStatus TestStoredFields(AtomicReader reader, Tex { Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + //infoStream.WriteLine(e.StackTrace); } return status; @@ -1732,7 +1732,7 @@ public static Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWrit try { infoStream?.Write(" test: docvalues..........."); - + foreach (FieldInfo fieldInfo in reader.FieldInfos) { if (fieldInfo.HasDocValues) @@ -1755,12 +1755,12 @@ public static Status.DocValuesStatus TestDocValues(AtomicReader reader, TextWrit { Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. infoStream?.WriteLine(e.ToString()); - //infoStream.WriteLine(e.StackTrace); + //infoStream.WriteLine(e.StackTrace); } return status; } @@ -2278,7 +2278,7 @@ public static Status.TermVectorStatus TestTermVectors(AtomicReader reader, TextW { Msg(infoStream, "ERROR [" + e.Message + "]"); status.Error = e; - + // LUCENENET NOTE: Some tests rely on the error type being in // the message. We can't get the error type with StackTrace, we // need ToString() for that. @@ -2363,6 +2363,19 @@ public virtual void FixIndex(Status result) /////

///// this tool exits with exit code 1 if the index cannot be opened or has any ///// corruption, else 0. + + + ///

+ /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index check + /// + /// The command line arguments + /// Thrown if invalid arguments are provided [STAThread] public static void Main(string[] args) { @@ -2524,4 +2537,4 @@ public static void Main(string[] args) Environment.Exit(exitCode); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexUpgrader.cs b/src/Lucene.Net/Index/IndexUpgrader.cs index 841c312d23..731369ed72 100644 --- a/src/Lucene.Net/Index/IndexUpgrader.cs +++ b/src/Lucene.Net/Index/IndexUpgrader.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Util; +using Lucene.Net.Util; using System; using System.Collections.Generic; using System.IO; @@ -29,22 +29,33 @@ namespace Lucene.Net.Index using FSDirectory = Lucene.Net.Store.FSDirectory; using InfoStream = Lucene.Net.Util.InfoStream; + // LUCENENET: Not used + ///// + ///// java -cp lucene-core.jar Lucene.Net.Index.IndexUpgrader [-delete-prior-commits] [-verbose] indexDir + ///// + /// /// This is an easy-to-use tool that upgrades all segments of an index from previous Lucene versions - /// to the current segment file format. It can be used from command line: - /// - /// java -cp lucene-core.jar Lucene.Net.Index.IndexUpgrader [-delete-prior-commits] [-verbose] indexDir - /// + /// to the current segment file format. It can be used from command line. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// index upgrade + /// /// Alternatively this class can be instantiated and invoked. It uses /// and triggers the upgrade via an request to . - /// + /// /// This tool keeps only the last commit in an index; for this /// reason, if the incoming index has more than one commit, the tool /// refuses to run by default. Specify -delete-prior-commits /// to override this, allowing the tool to delete all but the last commit. /// From .NET code this can be enabled by passing true to /// . - /// + /// /// Warning: this tool may reorder documents if the index was partially /// upgraded before execution (e.g., documents were added). If your application relies /// on "monotonicity" of doc IDs (which means that the order in which the documents @@ -73,7 +84,17 @@ private static void PrintUsage() /// /// Main method to run from the /// command-line. + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// index upgrade /// + /// The command line arguments + /// Thrown if any incorrect arguments are provided public static void Main(string[] args) { ParseArgs(args).Upgrade(); @@ -218,4 +239,4 @@ public void Upgrade() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/LockStressTest.cs b/src/Lucene.Net/Store/LockStressTest.cs index b5dc516c4f..dc0b218e5c 100644 --- a/src/Lucene.Net/Store/LockStressTest.cs +++ b/src/Lucene.Net/Store/LockStressTest.cs @@ -28,13 +28,32 @@ namespace Lucene.Net.Store /// /// Simple standalone tool that forever acquires & releases a - /// lock using a specific . Run without any args - /// to see usage. + /// lock using a specific . + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// lock stress-test /// /// /// public static class LockStressTest // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// lock stress-test + /// + /// The command line arguments + /// Thrown if the incorrect number of arguments are provided [STAThread] [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Security Hotspot", "S2245:Using pseudorandom number generators (PRNGs) is security-sensitive", Justification = "The Random class is only used to generate a timeout value")] @@ -44,20 +63,20 @@ public static void Main(string[] args) { // LUCENENET specific - our lucene-cli wrapper console shows the correct usage throw new ArgumentException(); - //Console.WriteLine("Usage: java Lucene.Net.Store.LockStressTest myID verifierHost verifierPort lockFactoryClassName lockDirName sleepTimeMS count\n" + - // "\n" + - // " myID = int from 0 .. 255 (should be unique for test process)\n" + - // " verifierHost = hostname that LockVerifyServer is listening on\n" + - // " verifierPort = port that LockVerifyServer is listening on\n" + - // " lockFactoryClassName = primary LockFactory class that we will use\n" + - // " lockDirName = path to the lock directory (only set for Simple/NativeFSLockFactory\n" + - // " sleepTimeMS = milliseconds to pause betweeen each lock obtain/release\n" + - // " count = number of locking tries\n" + - // "\n" + - // "You should run multiple instances of this process, each with its own\n" + - // "unique ID, and each pointing to the same lock directory, to verify\n" + - // "that locking is working correctly.\n" + - // "\n" + + //Console.WriteLine("Usage: java Lucene.Net.Store.LockStressTest myID verifierHost verifierPort lockFactoryClassName lockDirName sleepTimeMS count\n" + + // "\n" + + // " myID = int from 0 .. 255 (should be unique for test process)\n" + + // " verifierHost = hostname that LockVerifyServer is listening on\n" + + // " verifierPort = port that LockVerifyServer is listening on\n" + + // " lockFactoryClassName = primary LockFactory class that we will use\n" + + // " lockDirName = path to the lock directory (only set for Simple/NativeFSLockFactory\n" + + // " sleepTimeMS = milliseconds to pause betweeen each lock obtain/release\n" + + // " count = number of locking tries\n" + + // "\n" + + // "You should run multiple instances of this process, each with its own\n" + + // "unique ID, and each pointing to the same lock directory, to verify\n" + + // "that locking is working correctly.\n" + + // "\n" + // "Make sure you are first running LockVerifyServer."); //Environment.FailFast("1"); } @@ -172,4 +191,4 @@ public static void Main(string[] args) Console.WriteLine("Finished " + count + " tries."); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Store/LockVerifyServer.cs b/src/Lucene.Net/Store/LockVerifyServer.cs index 203afa121d..5da9d58bb8 100644 --- a/src/Lucene.Net/Store/LockVerifyServer.cs +++ b/src/Lucene.Net/Store/LockVerifyServer.cs @@ -34,12 +34,31 @@ namespace Lucene.Net.Store /// Simple standalone server that must be running when you /// use . This server simply /// verifies at most one process holds the lock at a time. - /// Run without any args to see usage. + /// + /// LUCENENET specific: In the Java implementation, this class' Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to that method: + /// lock verify-server /// /// /// public static class LockVerifyServer // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable { + + /// + /// LUCENENET specific: In the Java implementation, this Main method + /// was intended to be called from the command line. However, in .NET a + /// method within a DLL can't be directly called from the command line so we + /// provide a .NET tool, + /// lucene-cli, + /// with a command that maps to this method: + /// lock verify-server + /// + /// The command line arguments + /// Thrown if the incorrect number of arguments are provided [STAThread] public static void Main(string[] args) { @@ -194,4 +213,4 @@ public override void Run() } } } -} \ No newline at end of file +} diff --git a/src/dotnet/tools/lucene-cli/commands/benchmark/benchmark-find-quality-queries/BenchmarkFindQualityQueriesCommand.cs b/src/dotnet/tools/lucene-cli/commands/benchmark/benchmark-find-quality-queries/BenchmarkFindQualityQueriesCommand.cs index 81ad29b039..f5f5324a4a 100644 --- a/src/dotnet/tools/lucene-cli/commands/benchmark/benchmark-find-quality-queries/BenchmarkFindQualityQueriesCommand.cs +++ b/src/dotnet/tools/lucene-cli/commands/benchmark/benchmark-find-quality-queries/BenchmarkFindQualityQueriesCommand.cs @@ -1,4 +1,5 @@ using Lucene.Net.Benchmarks.Quality.Trec; +using Lucene.Net.Benchmarks.Quality.Utils; namespace Lucene.Net.Cli { @@ -25,7 +26,7 @@ public class Configuration : ConfigurationBase { public Configuration(CommandLineOptions options) { - this.Main = (args) => QueryDriver.Main(args); + this.Main = (args) => QualityQueriesFinder.Main(args); this.Name = "find-quality-queries"; this.Description = FromResource("Description");