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");