This is an automated email from the ASF dual-hosted git repository.
paulirwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
The following commit(s) were added to refs/heads/master by this push:
new 193966586 Fixes #(959): Fix TermStats.TermText access, add CLI
comments and 1 CLI bug fix (#963)
193966586 is described below
commit 19396658661fa122ef02393a770f598dbf920abb
Author: Ron Clabo <[email protected]>
AuthorDate: Tue Oct 22 16:51:42 2024 -0400
Fixes #(959): Fix TermStats.TermText access, add CLI comments and 1 CLI bug
fix (#963)
* Make TermStats.TermText public (#959)
* SWEEP: Added XML comments for Main(args) methods that are only intended
for command line CLI usage.
* BUG: Lucene,Net.Cli.BenchmarkFindQualityQueriesCommand: fixed mapping to
QualityQueriesFinder.Main(args)
* Better approach to fixing TermStats.TermText to fix one failing unit test.
* Address PR feedback
---------
Co-authored-by: Paul Irwin <[email protected]>
---
.../Tools/DictionaryBuilder.cs | 18 +++++++
.../Egothor.Stemmer/Compile.cs | 18 ++++++-
.../Egothor.Stemmer/DiffIt.cs | 19 ++++++-
src/Lucene.Net.Benchmark/ByTask/Benchmark.cs | 10 +++-
.../ByTask/Programmatic/Sample.cs | 19 +++++++
.../Quality/Trec/QueryDriver.cs | 19 +++++++
.../Quality/Utils/QualityQueriesFinder.cs | 16 +++++-
src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs | 10 ++++
src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs | 10 ++++
.../Facet/AssociationsFacetsExample.cs | 5 +-
src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs | 5 +-
.../Facet/ExpressionAggregationFacetsExample.cs | 5 +-
.../Facet/MultiCategoryListsFacetsExample.cs | 5 +-
src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs | 5 +-
src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs | 5 +-
.../Facet/SimpleSortedSetFacetsExample.cs | 7 +--
src/Lucene.Net.Demo/IndexFiles.cs | 24 ++++-----
src/Lucene.Net.Demo/SearchFiles.cs | 9 ++--
src/Lucene.Net.Misc/Index/CompoundFileExtractor.cs | 23 ++++++--
src/Lucene.Net.Misc/Index/IndexSplitter.cs | 29 ++++++++--
.../Index/MultiPassIndexSplitter.cs | 29 ++++++----
src/Lucene.Net.Misc/Misc/GetTermInfo.cs | 24 ++++++++-
src/Lucene.Net.Misc/Misc/HighFreqTerms.cs | 42 ++++++++++-----
src/Lucene.Net.Misc/Misc/IndexMergeTool.cs | 22 +++++++-
src/Lucene.Net.Misc/Misc/TermStats.cs | 10 ++--
.../Misc/TestHighFreqTerms.cs | 4 +-
src/Lucene.Net/Index/CheckIndex.cs | 61 +++++++++++++---------
src/Lucene.Net/Index/IndexUpgrader.cs | 37 ++++++++++---
src/Lucene.Net/Store/LockStressTest.cs | 53 +++++++++++++------
src/Lucene.Net/Store/LockVerifyServer.cs | 23 +++++++-
.../BenchmarkFindQualityQueriesCommand.cs | 3 +-
31 files changed, 442 insertions(+), 127 deletions(-)
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs
b/src/Lucene.Net.Analysis.Kuromoji/Tools/DictionaryBuilder.cs
index 83fd993ee..c6f222290 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.
*/
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// analysis kuromoji-build-dictionary.
+ /// </summary>
public static class DictionaryBuilder // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
public enum DictionaryFormat { IPADIC, UNIDIC };
@@ -62,6 +71,15 @@ namespace Lucene.Net.Analysis.Ja.Util
Console.WriteLine("done");
}
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// analysis kuromoji-build-dictionary.
+ /// </summary>
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 a42b1f538..d7790b475 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
{
/// <summary>
/// The Compile class is used to compile a stemmer table.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// analysis stempel-compile-stems
/// </summary>
public static class Compile // LUCENENET specific: CA1052 Static holder
types should be Static or NotInheritable
{
@@ -75,11 +83,19 @@ namespace Egothor.Stemmer
/// <summary>
/// Entry point to the Compile application.
- /// <para/>
+ /// <para />
/// 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.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// analysis stempel-compile-stems
/// </summary>
/// <param name="args">the command line arguments</param>
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 9a48e1c9d..f1053e94a 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
/// <summary>
/// The DiffIt class is a means generate patch commands from an already
prepared
/// stemmer table.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// analysis stempel-patch-stems
/// </summary>
public static class DiffIt // LUCENENET specific: CA1052 Static holder
types should be Static or NotInheritable
{
@@ -83,11 +91,18 @@ namespace Egothor.Stemmer
/// <summary>
/// Entry point to the DiffIt application.
- /// <para>
+ /// <para />
/// 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.
- /// </para>
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// analysis stempel-patch-stems
/// </summary>
/// <param name="args">the path to a file containing a stemmer
table</param>
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 6b0b7a904..8f04e2fda 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Benchmark.cs
@@ -98,6 +98,14 @@ namespace Lucene.Net.Benchmarks.ByTask
/// <summary>
/// Run the benchmark algorithm.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark
/// </summary>
/// <param name="args">Benchmark config and algorithm files.</param>
public static void Main(string[] args)
@@ -120,7 +128,7 @@ namespace Lucene.Net.Benchmarks.ByTask
//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 7f0078fc4..1e7500faa 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
/// <summary>
/// Sample performance test written programmatically - no algorithm file
is needed here.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// benchmark sample
/// </summary>
public static class Sample // LUCENENET specific: CA1052 Static holder
types should be Static or NotInheritable
{
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark sample
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
[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 ca045a42e..482c6130a 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
/// <summary>
/// Command-line tool for doing a TREC evaluation run.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// benchmark run-trec-eval
/// </summary>
public static class QueryDriver // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark run-trec-eval
+ /// </summary>
+ /// <param name="args">Must contain 4 or 5 values</param>
+ /// <exception cref="ArgumentException">Thrown if the incorrect number
of arguments are provided.</exception>
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 1592d1734..62f23ec39 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
/// <summary>
/// Suggest Quality queries based on an index contents.
/// Utility class, used for making quality test benchmarks.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// benchmark find-quality-queries
/// </summary>
public class QualityQueriesFinder
{
@@ -43,7 +51,13 @@ namespace Lucene.Net.Benchmarks.Quality.Utils
}
/// <summary>
- ///
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark find-quality-queries
/// </summary>
/// <param name="args">{index-dir}</param>
/// <exception cref="IOException">if cannot access the
index.</exception>
diff --git a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
index b34c36cba..be1f79aa2 100644
--- a/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
+++ b/src/Lucene.Net.Benchmark/Utils/ExtractReuters.cs
@@ -132,6 +132,16 @@ namespace Lucene.Net.Benchmarks.Utils
}
}
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark extract-reuters
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
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 e81f6cf94..d25bceb2f 100644
--- a/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs
+++ b/src/Lucene.Net.Benchmark/Utils/ExtractWikipedia.cs
@@ -118,6 +118,16 @@ namespace Lucene.Net.Benchmarks.Utils
Console.WriteLine("Extraction took " + (finish - start) + " ms");
}
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// benchmark extract-wikipedia
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
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 e8ac0b154..8fda2e576 100644
--- a/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/AssociationsFacetsExample.cs
@@ -43,8 +43,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -158,6 +158,7 @@ namespace Lucene.Net.Demo.Facet
/// <summary>Runs the sum int/float associations examples and prints
the results.</summary>
+ /// <param name="args">The command line arguments</param>
[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 4a8d7f851..ba05f0e3b 100644
--- a/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/DistanceFacetsExample.cs
@@ -50,8 +50,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -264,6 +264,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search and drill-down examples and prints the
results.</summary>
+ /// <param name="args">The command line arguments</param>
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 514dfc26f..b2c752d0b 100644
--- a/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/ExpressionAggregationFacetsExample.cs
@@ -44,8 +44,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -116,6 +116,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search and drill-down examples and prints the
results.</summary>
+ /// <param name="args">The command line arguments</param>
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 656d5570d..b32fe3761 100644
--- a/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/MultiCategoryListsFacetsExample.cs
@@ -42,8 +42,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -135,6 +135,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search example and prints the results.</summary>
+ /// <param name="args">The command line arguments</param>
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 a5c1d263d..8e05b7b68 100644
--- a/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/RangeFacetsExample.cs
@@ -40,8 +40,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -126,6 +126,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search and drill-down examples and prints the
results.</summary>
+ /// <param name="args">The command line arguments</param>
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 9f591e3e3..b4c1c0c6d 100644
--- a/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs
+++ b/src/Lucene.Net.Demo/Facet/SimpleFacetsExample.cs
@@ -42,8 +42,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -234,6 +234,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search and drill-down examples and prints the
results.</summary>
+ /// <param name="args">The command line arguments</param>
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 b78701537..000fcba06 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
{
/// <summary>
/// Shows simple usage of faceted indexing and search
- /// using <see cref="SortedSetDocValuesFacetField"/> and
+ /// using <see cref="SortedSetDocValuesFacetField"/> and
/// <see cref="SortedSetDocValuesFacetCounts"/>.
/// </summary>
public class SimpleSortedSetFacetsExample
@@ -43,8 +43,8 @@ namespace Lucene.Net.Demo.Facet
/// <summary>
/// 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.
/// </summary>
private const LuceneVersion EXAMPLE_VERSION = LuceneVersion.LUCENE_48;
@@ -152,6 +152,7 @@ namespace Lucene.Net.Demo.Facet
}
/// <summary>Runs the search and drill-down examples and prints the
results.</summary>
+ /// <param name="args">The command line arguments</param>
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 efae0eb4b..ba3173c99 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.
/// <para/>
/// This is a command-line application demonstrating simple Lucene
indexing.
- /// Run it with no command-line arguments for usage information.
/// </summary>
public static class IndexFiles // LUCENENET specific: CA1052 Static holder
types should be Static or NotInheritable
{
/// <summary>Index all text files under a directory.</summary>
+ /// <param name="args">The command line arguments</param>
public static void Main(string[] args)
{
// The <CONSOLE_APP_NAME> 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 <CONSOLE_APP_NAME> will be "dotnet
<DLL_NAME>.dll".
string usage = "Usage: <CONSOLE_APP_NAME> <INDEX_DIRECTORY>
<SOURCE_DIRECTORY> "
+ "[-u|--update]\n\n"
+ "This indexes the documents in <SOURCE_DIRECTORY>,
creating a Lucene index"
+ "in <INDEX_DIRECTORY> 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 @@ namespace Lucene.Net.Demo
}
/// <summary>
- /// Recurses over files and directories found under the
+ /// Recurses over files and directories found under the
/// given directory and indexes each file.<para/>
- ///
- /// 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).
/// </summary>
/// <param name="writer">
- /// <see cref="IndexWriter"/> to the index where the given
+ /// <see cref="IndexWriter"/> to the index where the given
/// file/dir info will be stored
/// </param>
/// <param name="directoryInfo">
@@ -163,7 +163,7 @@ namespace Lucene.Net.Demo
/// Indexes the given file using the given writer.<para/>
/// </summary>
/// <param name="writer">
- /// <see cref="IndexWriter"/> to the index where the given
+ /// <see cref="IndexWriter"/> to the index where the given
/// file info will be stored.
/// </param>
/// <param name="file">
@@ -179,7 +179,7 @@ namespace Lucene.Net.Demo
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 @@ namespace Lucene.Net.Demo
}
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 a8267af1a..b001396bf 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
{
/// <summary>Simple command-line based search demo.</summary>
+ /// <param name="args">The command line arguments</param>
public static void Main(string[] args)
{
// The <CONSOLE_APP_NAME> 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 <CONSOLE_APP_NAME> will be "dotnet
<DLL_NAME>.dll".
string usage = "Usage: <CONSOLE_APP_NAME> <INDEX_DIRECTORY>
[-f|--field <FIELD>] " +
@@ -53,7 +54,7 @@ namespace Lucene.Net.Demo
"[--raw] [-p|--page-size <NUMBER>]\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 @@ namespace Lucene.Net.Demo
}
/// <summary>
- /// 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.
/// <para/>
@@ -209,7 +210,7 @@ namespace Lucene.Net.Demo
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 c0bed26c5..514bfdcf5 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
/// <summary>
/// Command-line tool for extracting sub-files out of a compound file.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with two commands that map to that method:
+ /// index extract-cfs and index list-cfs
/// </summary>
public static class CompoundFileExtractor // LUCENENET specific: CA1052
Static holder types should be Static or NotInheritable
{
@@ -32,8 +40,17 @@ namespace Lucene.Net.Index
/// 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. </summary>
- ///// <param name="args"> Usage: org.apache.lucene.index.IndexReader
[-extract] <cfsfile> </param>
+ /// the segments file from the compound index into the directory where
the extracted files are stored.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with two commands that map to this method:
+ /// index extract-cfs and index list-cfs
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
public static void Main(string[] args)
{
string filename = null;
@@ -151,4 +168,4 @@ namespace Lucene.Net.Index
}
}
}
-}
\ 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 3d0249240..1d6e409ec 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.
- ///
- /// <para>This tool does file-level copying of segments files.
+ ///
+ /// <para />
+ /// 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.</para>
- ///
+ /// FSDirectory Directory impls.
+ ///
/// @lucene.experimental You can easily
/// accidentally remove segments from your index so be
/// careful!
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with three commands that map to that method:
+ /// index copy-segments, index delete-segments, and index list-segments
/// </summary>
public class IndexSplitter
{
@@ -50,6 +59,16 @@ namespace Lucene.Net.Index
internal DirectoryInfo dir;
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with three commands that map to this method:
+ /// index copy-segments, index delete-segments, and index list-segments
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
public static void Main(string[] args)
{
if (args.Length < 2)
@@ -179,4 +198,4 @@ namespace Lucene.Net.Index
@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 30fe0d7ea..98c290086 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 <see cref="IndexWriter.AddIndexes(IndexReader[])"/> where
the input data
/// comes from the input index with artificially applied deletes to the
document
/// id-s that fall outside the selected partition.
- /// <para>Note 1: Deletes are only applied to a buffered list of deleted
docs and
+ /// <para />
+ /// 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.
- /// </para>
- /// <para>Note 2: the disadvantage of this tool is that source index needs
to be
+ /// <para />
+ /// 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.
- ///
- /// </para>
- /// <para><b>NOTE</b>: this tool is unaware of documents added
- /// atomically via <see
cref="IndexWriter.AddDocuments(IEnumerable{IEnumerable{IIndexableField}},
Analysis.Analyzer)"/> or
+ /// <para />
+ /// <b>NOTE</b>: this tool is unaware of documents added
+ /// atomically via <see
cref="IndexWriter.AddDocuments(IEnumerable{IEnumerable{IIndexableField}},
Analysis.Analyzer)"/> or
/// <see cref="IndexWriter.UpdateDocuments(Term,
IEnumerable{IEnumerable{IIndexableField}}, Analysis.Analyzer)"/>, which means
it can easily
/// break up such document groups.
- /// </para>
/// </summary>
public class MultiPassIndexSplitter
{
@@ -120,6 +119,18 @@ namespace Lucene.Net.Index
Console.Error.WriteLine("Done.");
}
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index split
+ /// </summary>
+ /// <param name="args"></param>
+ /// <exception cref="ArgumentException"></exception>
public static void Main(string[] args)
{
if (args.Length < 5)
@@ -318,4 +329,4 @@ namespace Lucene.Net.Index
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 fb7fd1e84..1e5710ebf 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
*/
/// <summary>
- /// 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.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// index list-term-info
/// </summary>
public static class GetTermInfo // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index list-term-info
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if the incorrect number
of arguments are provided</exception>
public static void Main(string[] args)
{
@@ -64,4 +84,4 @@ namespace Lucene.Net.Misc
// Console.WriteLine("\n\nusage:\n\t" + "java " +
typeof(GetTermInfo).FullName + " <index dir> 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 1153f1f21..990f459dd 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.
+
/// <summary>
/// <see cref="HighFreqTerms"/> class extracts the top n most frequent
terms
/// (by document frequency) from an existing Lucene index and reports their
/// document frequency.
- /// <para>
- /// If the -t flag is given, both document frequency and total tf (total
- /// number of occurrences) are reported, ordered by descending total tf.
- ///
- /// </para>
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// index list-high-freq-terms
/// </summary>
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;
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index list-high-freq-terms
+ /// </summary>
+ /// <param name="args"></param>
+ /// <exception cref="ArgumentException"></exception>
public static void Main(string[] args)
{
string field = null;
@@ -81,7 +99,7 @@ namespace Lucene.Net.Misc
}
}
- // 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 <index dir> [-t] [number_terms]
[field]\n\t -t: order by totalTermFreq\n\n");
@@ -156,7 +174,7 @@ namespace Lucene.Net.Misc
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 @@ namespace Lucene.Net.Misc
}
/// <summary>
- /// Compares terms by <see cref="TermStats.TotalTermFreq"/>
+ /// Compares terms by <see cref="TermStats.TotalTermFreq"/>
/// </summary>
public sealed class TotalTermFreqComparer : IComparer<TermStats>
{
@@ -180,7 +198,7 @@ namespace Lucene.Net.Misc
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 @@ namespace Lucene.Net.Misc
/// <summary>
/// Priority queue for <see cref="TermStats"/> objects
- ///
+ ///
/// </summary>
internal sealed class TermStatsQueue : PriorityQueue<TermStats>
{
internal readonly IComparer<TermStats> comparer;
#nullable enable
- internal TermStatsQueue(int size, IComparer<TermStats> comparer)
+ internal TermStatsQueue(int size, IComparer<TermStats> comparer)
: base(size)
{
this.comparer = comparer ?? throw new
ArgumentNullException(nameof(comparer)); // LUCENENET: Added null guard clause
@@ -217,4 +235,4 @@ namespace Lucene.Net.Misc
}
}
}
-}
\ 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 defd30841..2208599e6 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
/// <summary>
/// Merges indices specified on the command line into the index
/// specified as the first command line argument.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// index merge
/// </summary>
public static class IndexMergeTool // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index merge
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if the incorrect number
of arguments are provided</exception>
public static void Main(string[] args)
{
if (args.Length < 3)
@@ -68,4 +88,4 @@ namespace Lucene.Net.Misc
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 18ec5942f..7ac5fbc91 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
/// </summary>
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 @@ namespace Lucene.Net.Misc
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 5c7248985..65ab7d4e1 100644
--- a/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
+++ b/src/Lucene.Net.Tests.Misc/Misc/TestHighFreqTerms.cs
@@ -122,7 +122,7 @@ namespace Lucene.Net.Misc
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 @@ namespace Lucene.Net.Misc
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 68c15734a..31084de38 100644
--- a/src/Lucene.Net/Index/CheckIndex.cs
+++ b/src/Lucene.Net/Index/CheckIndex.cs
@@ -107,7 +107,7 @@ namespace Lucene.Net.Index
/// <summary>
/// Empty unless you passed specific segments list to check as
optional 3rd argument. </summary>
/// <seealso cref="CheckIndex.DoCheckIndex(IList{string})"/>
- public IList<string> SegmentsChecked { get; internal set; } //
LUCENENET specific - made setter internal
+ public IList<string> SegmentsChecked { get; internal set; } //
LUCENENET specific - made setter internal
/// <summary>
/// True if the index was created with a newer version of Lucene
than the <see cref="CheckIndex"/> tool. </summary>
@@ -137,7 +137,7 @@ namespace Lucene.Net.Index
public int NumBadSegments { get; internal set; } // LUCENENET
specific - made setter internal
/// <summary>
- /// True if we checked only specific segments
+ /// True if we checked only specific segments
/// (<see cref="DoCheckIndex(IList{string})"/> was called with
non-null
/// argument).
/// </summary>
@@ -519,13 +519,13 @@ namespace Lucene.Net.Index
{
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 @@ namespace Lucene.Net.Index
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 @@ namespace Lucene.Net.Index
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 @@ namespace Lucene.Net.Index
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 @@ namespace Lucene.Net.Index
// Test getFieldInfos()
infoStream?.Write(" test: fields..............");
-
+
FieldInfos fieldInfos = reader.FieldInfos;
Msg(infoStream, "OK [" + fieldInfos.Count + " fields]");
segInfoStat.NumFields = fieldInfos.Count;
@@ -873,7 +873,7 @@ namespace Lucene.Net.Index
// 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 @@ namespace Lucene.Net.Index
{
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 @@ namespace Lucene.Net.Index
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 @@ namespace Lucene.Net.Index
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 @@ namespace Lucene.Net.Index
{
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 @@ namespace Lucene.Net.Index
try
{
infoStream?.Write(" test: docvalues...........");
-
+
foreach (FieldInfo fieldInfo in reader.FieldInfos)
{
if (fieldInfo.HasDocValues)
@@ -1755,12 +1755,12 @@ namespace Lucene.Net.Index
{
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 @@ namespace Lucene.Net.Index
{
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 @@ namespace Lucene.Net.Index
///// <p>
///// this tool exits with exit code 1 if the
index cannot be opened or has any
///// corruption, else 0.
+
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index check
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if invalid arguments
are provided</exception>
[STAThread]
public static void Main(string[] args)
{
@@ -2524,4 +2537,4 @@ namespace Lucene.Net.Index
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 841c312d2..731369ed7 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
+ ///// <code>
+ ///// java -cp lucene-core.jar Lucene.Net.Index.IndexUpgrader
[-delete-prior-commits] [-verbose] indexDir
+ ///// </code>
+
/// <summary>
/// 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:
- /// <code>
- /// java -cp lucene-core.jar Lucene.Net.Index.IndexUpgrader
[-delete-prior-commits] [-verbose] indexDir
- /// </code>
+ /// to the current segment file format. It can be used from command line.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// index upgrade
+ /// <para />
/// Alternatively this class can be instantiated and <see
cref="Upgrade()"/> invoked. It uses <see cref="UpgradeIndexMergePolicy"/>
/// and triggers the upgrade via an <see
cref="IndexWriter.ForceMerge(int)"/> request to <see cref="IndexWriter"/>.
- /// <para/>
+ /// <para />
/// 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 <c>-delete-prior-commits</c>
/// to override this, allowing the tool to delete all but the last commit.
/// From .NET code this can be enabled by passing <c>true</c> to
/// <see cref="IndexUpgrader(Directory, LuceneVersion, TextWriter,
bool)"/>.
- /// <para/>
+ /// <para />
/// <b>Warning:</b> 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 @@ namespace Lucene.Net.Index
/// <summary>
/// Main method to run <see cref="IndexUpgrader"/> from the
/// command-line.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// index upgrade
/// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if any incorrect
arguments are provided</exception>
public static void Main(string[] args)
{
ParseArgs(args).Upgrade();
@@ -218,4 +239,4 @@ namespace Lucene.Net.Index
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Lucene.Net/Store/LockStressTest.cs
b/src/Lucene.Net/Store/LockStressTest.cs
index b5dc516c4..dc0b218e5 100644
--- a/src/Lucene.Net/Store/LockStressTest.cs
+++ b/src/Lucene.Net/Store/LockStressTest.cs
@@ -28,13 +28,32 @@ namespace Lucene.Net.Store
/// <summary>
/// Simple standalone tool that forever acquires & releases a
- /// lock using a specific <see cref="LockFactory"/>. Run without any args
- /// to see usage.
+ /// lock using a specific <see cref="LockFactory"/>.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// lock stress-test
/// </summary>
/// <seealso cref="VerifyingLockFactory"/>
/// <seealso cref="LockVerifyServer"/>
public static class LockStressTest // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// lock stress-test
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if the incorrect number
of arguments are provided</exception>
[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 @@ namespace Lucene.Net.Store
{
// 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 @@ namespace Lucene.Net.Store
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 203afa121..5da9d58bb 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 <see cref="VerifyingLockFactory"/>. This server simply
/// verifies at most one process holds the lock at a time.
- /// Run without any args to see usage.
+ /// <para />
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to that method:
+ /// lock verify-server
/// </summary>
/// <seealso cref="VerifyingLockFactory"/>
/// <seealso cref="LockStressTest"/>
public static class LockVerifyServer // LUCENENET specific: CA1052 Static
holder types should be Static or NotInheritable
{
+
+ /// <summary>
+ /// 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 <see
href="https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools">.NET
tool</see>,
+ /// <see
href="https://www.nuget.org/packages/lucene-cli">lucene-cli</see>,
+ /// with a command that maps to this method:
+ /// lock verify-server
+ /// </summary>
+ /// <param name="args">The command line arguments</param>
+ /// <exception cref="ArgumentException">Thrown if the incorrect number
of arguments are provided</exception>
[STAThread]
public static void Main(string[] args)
{
@@ -194,4 +213,4 @@ namespace Lucene.Net.Store
}
}
}
-}
\ 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 81ad29b03..f5f5324a4 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 @@ namespace Lucene.Net.Cli
{
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");