You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/07/11 07:42:27 UTC
[02/22] lucenenet git commit: Added lucene-cli + tests - a wrapper
console application so we can run the various utilities and demos in .NET on
the command line.
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/arguments/IndexDirectoryArgument.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/arguments/IndexDirectoryArgument.cs b/src/tools/lucene-cli/arguments/IndexDirectoryArgument.cs
new file mode 100644
index 0000000..be54e71
--- /dev/null
+++ b/src/tools/lucene-cli/arguments/IndexDirectoryArgument.cs
@@ -0,0 +1,57 @@
+using Lucene.Net.Cli.CommandLine;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexDirectoryArgument : CommandArgument
+ {
+ private readonly bool required;
+
+ public IndexDirectoryArgument(bool required = false)
+ {
+ this.required = required;
+
+ if (required)
+ {
+ Name = "<INDEX_DIRECTORY>";
+ Description = Resources.Strings.IndexDirectoryArgumentDescription;
+ }
+ else
+ {
+ Name = "[<INDEX_DIRECTORY>]";
+ Description = Resources.Strings.IndexDirectoryArgumentDescription + " " + Resources.Strings.IndexDirectoryOptionalArgumentDescription;
+ }
+ }
+
+ public override string Value
+ {
+ get
+ {
+ if (required)
+ {
+ return base.Value;
+ }
+ // Return current directory if index directory not supplied.
+ return string.IsNullOrWhiteSpace(base.Value) ?
+ System.IO.Directory.GetCurrentDirectory() :
+ base.Value;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/arguments/SegmentsArgument.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/arguments/SegmentsArgument.cs b/src/tools/lucene-cli/arguments/SegmentsArgument.cs
new file mode 100644
index 0000000..bf6b0c9
--- /dev/null
+++ b/src/tools/lucene-cli/arguments/SegmentsArgument.cs
@@ -0,0 +1,31 @@
+using Lucene.Net.Cli.CommandLine;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class SegmentsArgument : CommandArgument
+ {
+ public SegmentsArgument()
+ {
+ Name = "<SEGMENT>[ [<SEGMENT_2] ...[<SEGMENT_N>]]";
+ Description = Resources.Strings.SegmentsArgumentDescription;
+ MultipleValues = true;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/RootCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/RootCommand.cs b/src/tools/lucene-cli/commands/RootCommand.cs
new file mode 100644
index 0000000..c0d0b93
--- /dev/null
+++ b/src/tools/lucene-cli/commands/RootCommand.cs
@@ -0,0 +1,46 @@
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class RootCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Description = FromResource("RootCommandDescription");
+
+ //// LUCENENET TODO: Fix this to use CommandLine stuff...
+ //this.VersionOption("-v|--version", typeof(Program).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);
+
+ this.Commands.Add(new AnalysisCommand.Configuration(options));
+ this.Commands.Add(new IndexCommand.Configuration(options));
+ this.Commands.Add(new LockCommand.Configuration(options));
+ this.Commands.Add(new DemoCommand.Configuration(options));
+
+ this.OnExecute(() => new RootCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.ShowHelp();
+ return 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/analysis/AnalysisCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/analysis/AnalysisCommand.cs b/src/tools/lucene-cli/commands/analysis/AnalysisCommand.cs
new file mode 100644
index 0000000..969bd58
--- /dev/null
+++ b/src/tools/lucene-cli/commands/analysis/AnalysisCommand.cs
@@ -0,0 +1,45 @@
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class AnalysisCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Name = "analysis";
+ this.Description = FromResource("Description");
+
+ //this.Commands.Add(new AnalysisICUBuildRBBIRulesCommand.Configuration(options));
+ //this.Commands.Add(new AnalysisKuromojiBuildDictionaryCommand.Configuration(options));
+ this.Commands.Add(new AnalysisStempelCompileStemsCommand.Configuration(options));
+ this.Commands.Add(new AnalysisStempelPatchStemsCommand.Configuration(options));
+
+
+ this.OnExecute(() => new AnalysisCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.ShowHelp();
+ return 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/analysis/analysis-stempel-compile-stems/AnalysisStempelCompileStemsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/analysis/analysis-stempel-compile-stems/AnalysisStempelCompileStemsCommand.cs b/src/tools/lucene-cli/commands/analysis/analysis-stempel-compile-stems/AnalysisStempelCompileStemsCommand.cs
new file mode 100644
index 0000000..2528813
--- /dev/null
+++ b/src/tools/lucene-cli/commands/analysis/analysis-stempel-compile-stems/AnalysisStempelCompileStemsCommand.cs
@@ -0,0 +1,77 @@
+using Egothor.Stemmer;
+using Lucene.Net.Cli.CommandLine;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class AnalysisStempelCompileStemsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => Compile.Main(args);
+
+ this.Name = "stempel-compile-stems";
+ this.Description = FromResource("Description");
+
+ this.StemmingAlgorithm = this.Argument(
+ "<STEMMING_ALGORITHM>",
+ FromResource("StemmingAlgorithmDescription"));
+ this.StemmerTableFiles = this.Argument(
+ "<STEMMER_TABLE_FILE>[ <STEMMER_TABLE_FILE_2>...]",
+ FromResource("StemmerTableFilesDescription"),
+ multipleValues: true);
+ this.StemmerTableFilesEncoding = this.Option(
+ "-e|--encoding <ENCODING>",
+ FromResource("StemmerTableFilesEncodingDescription"),
+ CommandOptionType.SingleValue);
+
+ this.OnExecute(() => new AnalysisStempelCompileStemsCommand().Run(this));
+ }
+
+ public virtual CommandArgument StemmingAlgorithm { get; private set; }
+ public virtual CommandArgument StemmerTableFiles { get; private set; }
+ public virtual CommandOption StemmerTableFilesEncoding { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(2))
+ {
+ return 1;
+ }
+
+ var input = cmd as Configuration;
+ var args = new List<string>() { input.StemmingAlgorithm.Value };
+
+ args.AddRange(input.StemmerTableFiles.Values);
+
+ if (input.StemmerTableFilesEncoding.HasValue())
+ {
+ args.Add("--encoding");
+ args.Add(input.StemmerTableFilesEncoding.Value());
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/analysis/analysis-stempel-patch-stems/AnalysisStempelPatchStemsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/analysis/analysis-stempel-patch-stems/AnalysisStempelPatchStemsCommand.cs b/src/tools/lucene-cli/commands/analysis/analysis-stempel-patch-stems/AnalysisStempelPatchStemsCommand.cs
new file mode 100644
index 0000000..4e24118
--- /dev/null
+++ b/src/tools/lucene-cli/commands/analysis/analysis-stempel-patch-stems/AnalysisStempelPatchStemsCommand.cs
@@ -0,0 +1,70 @@
+using Egothor.Stemmer;
+using Lucene.Net.Cli.CommandLine;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class AnalysisStempelPatchStemsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => DiffIt.Main(args);
+
+ this.Name = "stempel-patch-stems";
+ this.Description = FromResource("Description");
+
+ this.StemmerTableFiles = this.Argument(
+ "<STEMMER_TABLE_FILE>[ <STEMMER_TABLE_FILE_2>...]",
+ FromResource("StemmerTableFilesDescription"),
+ multipleValues: true);
+ this.StemmerTableFilesEncoding = this.Option(
+ "-e|--encoding <ENCODING>",
+ FromResource("StemmerTableFilesEncodingDescription"),
+ CommandOptionType.SingleValue);
+
+ this.OnExecute(() => new IndexListHighFreqTermsCommand().Run(this));
+ }
+
+ public virtual CommandArgument StemmerTableFiles { get; private set; }
+ public virtual CommandOption StemmerTableFilesEncoding { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ var input = cmd as Configuration;
+ var args = new List<string>(input.StemmerTableFiles.Values);
+
+ if (input.StemmerTableFilesEncoding.HasValue())
+ {
+ args.AddRange(input.StemmerTableFilesEncoding.Values);
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/DemoCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/DemoCommand.cs b/src/tools/lucene-cli/commands/demo/DemoCommand.cs
new file mode 100644
index 0000000..8ab8536
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/DemoCommand.cs
@@ -0,0 +1,49 @@
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Name = "demo";
+ this.Description = FromResource("Description");
+
+ this.Commands.Add(new DemoAssociationsFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoDistanceFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoExpressionAggregationFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoIndexFilesCommand.Configuration(options));
+ this.Commands.Add(new DemoMultiCategoryListsFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoRangeFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoSearchFilesCommand.Configuration(options));
+ this.Commands.Add(new DemoSimpleFacetsCommand.Configuration(options));
+ this.Commands.Add(new DemoSimpleSortedSetFacetsCommand.Configuration(options));
+
+ this.OnExecute(() => new DemoCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.ShowHelp();
+ return 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/DemoConfiguration.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/DemoConfiguration.cs b/src/tools/lucene-cli/commands/demo/DemoConfiguration.cs
new file mode 100644
index 0000000..d1f4eda
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/DemoConfiguration.cs
@@ -0,0 +1,90 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Cli.SourceCode;
+using System;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public abstract class DemoConfiguration : ConfigurationBase
+ {
+ private static readonly SourceCodeExporter sourceCodeExporter = new SourceCodeExporter();
+ protected readonly CommandOption viewSourceOption;
+ protected readonly CommandOption outputSourceOption;
+
+ protected DemoConfiguration()
+ {
+ this.viewSourceOption = this.Option(
+ "-src|--view-source-code",
+ Resources.Strings.ViewSourceCodeDescription,
+ CommandOptionType.NoValue);
+ this.outputSourceOption = this.Option(
+ "-out|--output-source-code <DIRECTORY>",
+ Resources.Strings.OutputSourceCodeDescription,
+ CommandOptionType.SingleValue);
+
+ this.viewSourceOption.ShowInHelpText = false;
+ this.outputSourceOption.ShowInHelpText = false;
+ }
+
+ public abstract IEnumerable<string> SourceCodeFiles { get; }
+
+ public override void OnExecute(Func<int> invoke)
+ {
+ base.OnExecute(() =>
+ {
+ bool viewSource = viewSourceOption.HasValue();
+ bool outputSource = outputSourceOption.HasValue();
+
+ if (viewSource || outputSource)
+ {
+ if (outputSource)
+ {
+ Out.WriteLine(Resources.Strings.ExportingSourceCodeMessage);
+
+ string outputPath = outputSourceOption.Value();
+ sourceCodeExporter.ExportSourceCodeFiles(this.SourceCodeFiles, outputPath);
+
+ Out.WriteLine(string.Format(Resources.Strings.ExportingSourceCodeCompleteMessage, outputPath));
+ }
+ if (viewSource)
+ {
+ using (var console = new ConsolePager(this.SourceCodeFiles))
+ {
+ console.Run();
+ }
+ }
+
+ return 0;
+ }
+
+ var result = invoke();
+ ShowOutputSourceCodeMessage();
+ return result;
+ });
+ }
+
+ public virtual void ShowOutputSourceCodeMessage()
+ {
+ this.Out.WriteLine();
+ this.Out.WriteLine("-------------------------");
+ this.Out.WriteLine(Resources.Strings.OutputSourceCodeMessage, this.Name);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-associations-facets/DemoAssociationsFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-associations-facets/DemoAssociationsFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-associations-facets/DemoAssociationsFacetsCommand.cs
new file mode 100644
index 0000000..f160f97
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-associations-facets/DemoAssociationsFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoAssociationsFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => AssociationsFacetsExample.Main(args);
+
+ this.Name = "associations-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoAssociationsFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "AssociationsFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-distance-facets/DemoDistanceFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-distance-facets/DemoDistanceFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-distance-facets/DemoDistanceFacetsCommand.cs
new file mode 100644
index 0000000..5229279
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-distance-facets/DemoDistanceFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoDistanceFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => DistanceFacetsExample.Main(args);
+
+ this.Name = "distance-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoDistanceFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "DistanceFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-expression-aggregation-facets/DemoExpressionAggregationFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-expression-aggregation-facets/DemoExpressionAggregationFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-expression-aggregation-facets/DemoExpressionAggregationFacetsCommand.cs
new file mode 100644
index 0000000..2ada74b
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-expression-aggregation-facets/DemoExpressionAggregationFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoExpressionAggregationFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => ExpressionAggregationFacetsExample.Main(args);
+
+ this.Name = "expression-aggregation-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoExpressionAggregationFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "ExpressionAggregationFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-index-files/DemoIndexFilesCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-index-files/DemoIndexFilesCommand.cs b/src/tools/lucene-cli/commands/demo/demo-index-files/DemoIndexFilesCommand.cs
new file mode 100644
index 0000000..70b7768
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-index-files/DemoIndexFilesCommand.cs
@@ -0,0 +1,85 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Demo;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoIndexFilesCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => IndexFiles.Main(args);
+
+ this.Name = "index-files";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.IndexDirectoryArgument = new IndexDirectoryArgument(required: true);
+ this.Arguments.Add(IndexDirectoryArgument);
+ this.SourceDirectoryArgument = this.Argument(
+ "<SOURCE_DIRECTORY>",
+ FromResource("SourceDirectoryDescription"));
+ this.UpdateOption = this.Option(
+ "-u|--update",
+ FromResource("UpdateDescription"),
+ CommandOptionType.NoValue);
+
+ this.OnExecute(() => new DemoIndexFilesCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "IndexFiles.cs" };
+ }
+ }
+
+ public CommandArgument IndexDirectoryArgument { get; private set; }
+ public CommandArgument SourceDirectoryArgument { get; private set; }
+ public CommandOption UpdateOption { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(2))
+ {
+ return 1;
+ }
+
+ var input = cmd as Configuration;
+ var args = new List<string>
+ {
+ input.IndexDirectoryArgument.Value,
+ input.SourceDirectoryArgument.Value
+ };
+
+ if (input.UpdateOption.HasValue())
+ {
+ args.Add("--update");
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-multi-category-lists-facets/DemoMultiCategoryListsFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-multi-category-lists-facets/DemoMultiCategoryListsFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-multi-category-lists-facets/DemoMultiCategoryListsFacetsCommand.cs
new file mode 100644
index 0000000..84350a6
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-multi-category-lists-facets/DemoMultiCategoryListsFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoMultiCategoryListsFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => MultiCategoryListsFacetsExample.Main(args);
+
+ this.Name = "multi-category-lists-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoMultiCategoryListsFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "MultiCategoryListsFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-range-facets/DemoRangeFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-range-facets/DemoRangeFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-range-facets/DemoRangeFacetsCommand.cs
new file mode 100644
index 0000000..187ccb3
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-range-facets/DemoRangeFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoRangeFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => RangeFacetsExample.Main(args);
+
+ this.Name = "range-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoRangeFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "RangeFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-search-files/DemoSearchFilesCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-search-files/DemoSearchFilesCommand.cs b/src/tools/lucene-cli/commands/demo/demo-search-files/DemoSearchFilesCommand.cs
new file mode 100644
index 0000000..b40e9c8
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-search-files/DemoSearchFilesCommand.cs
@@ -0,0 +1,134 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Demo;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoSearchFilesCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => SearchFiles.Main(args);
+
+ this.Name = "search-files";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.IndexDirectoryArgument = new IndexDirectoryArgument(required: true);
+ this.Arguments.Add(IndexDirectoryArgument);
+ this.FieldOption = this.Option(
+ "-f|--field <FIELD>",
+ FromResource("FieldDescription"),
+ CommandOptionType.SingleValue);
+ this.RepeatOption = this.Option(
+ "-r|--repeat <NUMBER>",
+ FromResource("RepeatDescription"),
+ CommandOptionType.SingleValue);
+ this.QueriesFileOption = this.Option(
+ "-qf|--queries-file <PATH>",
+ FromResource("QueriesFileDescription"),
+ CommandOptionType.SingleValue);
+ this.QueryOption = this.Option(
+ "-q|--query <QUERY>",
+ FromResource("QueryDescription"),
+ CommandOptionType.SingleValue);
+ this.RawOption = this.Option(
+ "--raw",
+ FromResource("RawDescription"),
+ CommandOptionType.NoValue);
+ this.PageSizeOption = this.Option(
+ "-p|--page-size <NUMBER>",
+ FromResource("PageSizeDescription"),
+ CommandOptionType.NoValue);
+
+
+ this.OnExecute(() => new DemoSearchFilesCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "SearchFiles.cs" };
+ }
+ }
+
+ public CommandArgument IndexDirectoryArgument { get; private set; }
+ public CommandOption FieldOption { get; private set; }
+ public CommandOption RepeatOption { get; private set; }
+ public CommandOption QueriesFileOption { get; private set; }
+ public CommandOption QueryOption { get; private set; }
+ public CommandOption RawOption { get; private set; }
+ public CommandOption PageSizeOption { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ var input = cmd as Configuration;
+ var args = new List<string> { input.IndexDirectoryArgument.Value };
+
+ if (input.FieldOption.HasValue())
+ {
+ args.Add("--field");
+ args.Add(input.FieldOption.Value());
+ }
+
+ if (input.RepeatOption.HasValue())
+ {
+ args.Add("--repeat");
+ args.Add(input.RepeatOption.Value());
+ }
+
+ if (input.QueriesFileOption.HasValue())
+ {
+ args.Add("--queries-file");
+ args.Add(input.QueriesFileOption.Value());
+ }
+
+ if (input.QueryOption.HasValue())
+ {
+ args.Add("--query");
+ args.Add(input.QueryOption.Value());
+ }
+
+ if (input.RawOption.HasValue())
+ {
+ args.Add("--raw");
+ args.Add(input.RawOption.Value());
+ }
+
+ if (input.PageSizeOption.HasValue())
+ {
+ args.Add("--page-size");
+ args.Add(input.PageSizeOption.Value());
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-simple-facets/DemoSimpleFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-simple-facets/DemoSimpleFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-simple-facets/DemoSimpleFacetsCommand.cs
new file mode 100644
index 0000000..9839ddc
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-simple-facets/DemoSimpleFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoSimpleFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => SimpleFacetsExample.Main(args);
+
+ this.Name = "simple-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoSimpleFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "SimpleFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/demo/demo-simple-sorted-set-facets/DemoSimpleSortedSetFacetsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/demo/demo-simple-sorted-set-facets/DemoSimpleSortedSetFacetsCommand.cs b/src/tools/lucene-cli/commands/demo/demo-simple-sorted-set-facets/DemoSimpleSortedSetFacetsCommand.cs
new file mode 100644
index 0000000..a790fc4
--- /dev/null
+++ b/src/tools/lucene-cli/commands/demo/demo-simple-sorted-set-facets/DemoSimpleSortedSetFacetsCommand.cs
@@ -0,0 +1,53 @@
+using Lucene.Net.Demo.Facet;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class DemoSimpleSortedSetFacetsCommand : ICommand
+ {
+ public class Configuration : DemoConfiguration
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => SimpleSortedSetFacetsExample.Main(args);
+
+ this.Name = "simple-sorted-set-facets";
+ this.Description = FromResource("Description");
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new DemoSimpleSortedSetFacetsCommand().Run(this));
+ }
+
+ public override IEnumerable<string> SourceCodeFiles
+ {
+ get
+ {
+ return new string[] { "SimpleSortedSetFacetsExample.cs" };
+ }
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.Main(new string[0]);
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/IndexCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/IndexCommand.cs b/src/tools/lucene-cli/commands/index/IndexCommand.cs
new file mode 100644
index 0000000..1665906
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/IndexCommand.cs
@@ -0,0 +1,53 @@
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Name = "index";
+ this.Description = FromResource("Description");
+
+ this.Commands.Add(new IndexCheckCommand.Configuration(options));
+ this.Commands.Add(new IndexCopySegmentsCommand.Configuration(options));
+ this.Commands.Add(new IndexDeleteSegmentsCommand.Configuration(options));
+ this.Commands.Add(new IndexExtractCfsCommand.Configuration(options));
+ this.Commands.Add(new IndexFixCommand.Configuration(options));
+ this.Commands.Add(new IndexListCfsCommand.Configuration(options));
+ this.Commands.Add(new IndexListHighFreqTermsCommand.Configuration(options));
+ this.Commands.Add(new IndexListSegmentsCommand.Configuration(options));
+ this.Commands.Add(new IndexListTaxonomyStatsCommand.Configuration(options));
+ this.Commands.Add(new IndexListTermInfoCommand.Configuration(options));
+ this.Commands.Add(new IndexMergeCommand.Configuration(options));
+ this.Commands.Add(new IndexSplitCommand.Configuration(options));
+ this.Commands.Add(new IndexUpgradeCommand.Configuration(options));
+
+ this.OnExecute(() => new IndexCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ cmd.ShowHelp();
+ return 1;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-check/IndexCheckCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-check/IndexCheckCommand.cs b/src/tools/lucene-cli/commands/index/index-check/IndexCheckCommand.cs
new file mode 100644
index 0000000..11d9e96
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-check/IndexCheckCommand.cs
@@ -0,0 +1,103 @@
+using Lucene.Net.Index;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexCheckCommand : ICommand
+ {
+ private readonly bool fix;
+
+ public IndexCheckCommand(bool fix)
+ {
+ this.fix = fix;
+ }
+
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => CheckIndex.Main(args);
+
+ this.Name = "check";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument());
+ this.Options.Add(new VerboseOption());
+ this.Options.Add(new CrossCheckTermVectorsOption());
+ this.Options.Add(new DirectoryTypeOption());
+ this.Options.Add(new SegmentOption(allowMultiple: true) { Description = FromResource("SegmentsDescription") });
+
+ // NOTE: We are intentionally calling fix here because it is exactly
+ // the same operation minus the -fix argument
+ OnExecute(() => new IndexCheckCommand(fix: false).Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ var args = new List<string>() { cmd.GetArgument<IndexDirectoryArgument>().Value };
+
+ if (fix)
+ {
+ args.Add("-fix");
+ }
+
+ // get cross check option
+ var crossCheckOption = cmd.GetOption<CrossCheckTermVectorsOption>();
+ if (crossCheckOption != null && crossCheckOption.HasValue())
+ {
+ args.Add("-crossCheckTermVectors");
+ }
+
+ // get vebose option
+ var verboseOption = cmd.GetOption<VerboseOption>();
+ if (verboseOption != null && verboseOption.HasValue())
+ {
+ args.Add("-verbose");
+ }
+
+ // get segment option
+ var segmentOption = cmd.GetOption<SegmentOption>();
+ if (segmentOption != null && segmentOption.HasValue())
+ {
+ foreach (var value in segmentOption.Values)
+ {
+ args.Add("-segment");
+ args.Add(value);
+ }
+ }
+
+ var directoryTypeOption = cmd.GetOption<DirectoryTypeOption>();
+ if (directoryTypeOption != null && directoryTypeOption.HasValue())
+ {
+ args.Add("-dir-impl");
+ args.Add(directoryTypeOption.Value());
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-copy-segments/IndexCopySegmentsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-copy-segments/IndexCopySegmentsCommand.cs b/src/tools/lucene-cli/commands/index/index-copy-segments/IndexCopySegmentsCommand.cs
new file mode 100644
index 0000000..47caa63
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-copy-segments/IndexCopySegmentsCommand.cs
@@ -0,0 +1,54 @@
+using Lucene.Net.Index;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexCopySegmentsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => IndexSplitter.Main(args);
+
+ this.Name = "copy-segments";
+ this.Description = FromResource("Description");
+
+ this.Argument("<INPUT_DIRECTORY>", FromResource("InputDirectoryDescription"));
+ this.Argument("<OUTPUT_DIRECTORY>", FromResource("OutputDirectoryDescription"));
+ this.Arguments.Add(new SegmentsArgument() { Description = FromResource("SegmentsDescription") });
+
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new IndexCopySegmentsCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(3))
+ {
+ return 1;
+ }
+
+ cmd.Main(cmd.GetNonNullArguments());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-delete-segments/IndexDeleteSegmentsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-delete-segments/IndexDeleteSegmentsCommand.cs b/src/tools/lucene-cli/commands/index/index-delete-segments/IndexDeleteSegmentsCommand.cs
new file mode 100644
index 0000000..fd02054
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-delete-segments/IndexDeleteSegmentsCommand.cs
@@ -0,0 +1,66 @@
+using Lucene.Net.Index;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexDeleteSegmentsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => IndexSplitter.Main(args);
+
+ this.Name = "delete-segments";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument(required: true));
+ this.Arguments.Add(new SegmentsArgument() { Description = FromResource("SegmentsDescription") });
+
+ this.ExtendedHelpText = FromResource("ExtendedHelpText");
+
+ this.OnExecute(() => new IndexDeleteSegmentsCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(2))
+ {
+ return 1;
+ }
+
+ var args = new List<string>() { cmd.GetNonNullArguments()[0] };
+ var segmentsArgument = cmd.GetArgument<SegmentsArgument>();
+ if (segmentsArgument != null)
+ {
+ foreach(var segment in segmentsArgument.Values)
+ {
+ args.Add("-d");
+ args.Add(segment);
+ }
+ }
+
+ cmd.Main(cmd.GetNonNullArguments().Union(new string[] { "-d" }).ToArray());
+ return 0;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-extract-cfs/IndexExtractCfsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-extract-cfs/IndexExtractCfsCommand.cs b/src/tools/lucene-cli/commands/index/index-extract-cfs/IndexExtractCfsCommand.cs
new file mode 100644
index 0000000..c3bce19
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-extract-cfs/IndexExtractCfsCommand.cs
@@ -0,0 +1,47 @@
+using Lucene.Net.Index;
+using System;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexExtractCfsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => CompoundFileExtractor.Main(args);
+
+ this.Name = "extract-cfs";
+ this.Description = FromResource("Description");
+
+ this.Argument("<CFS_FILE_NAME>", FromResource("CompoundFileNameDescription"));
+ this.Options.Add(new DirectoryTypeOption());
+
+ this.OnExecute(() => new IndexListCfsCommand(extract: true).Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ // NOTE: We call IndexListCfsCommand, so nothing to do here.
+ throw new NotSupportedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-fix/IndexFixCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-fix/IndexFixCommand.cs b/src/tools/lucene-cli/commands/index/index-fix/IndexFixCommand.cs
new file mode 100644
index 0000000..0418d49
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-fix/IndexFixCommand.cs
@@ -0,0 +1,50 @@
+using Lucene.Net.Index;
+using System;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexFixCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => CheckIndex.Main(args);
+
+ this.Name = "fix";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument());
+ this.Options.Add(new VerboseOption());
+ this.Options.Add(new CrossCheckTermVectorsOption());
+ this.Options.Add(new DirectoryTypeOption());
+ this.Options.Add(new SegmentOption(allowMultiple: true) { Description = FromResource("SegmentsDescpription") });
+
+ this.OnExecute(() => new IndexCheckCommand(fix: true).Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ // We call IndexCheckCommand - nothing to do here.
+ throw new NotSupportedException();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-list-cfs/IndexListCfsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-list-cfs/IndexListCfsCommand.cs b/src/tools/lucene-cli/commands/index/index-list-cfs/IndexListCfsCommand.cs
new file mode 100644
index 0000000..4b05cbb
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-list-cfs/IndexListCfsCommand.cs
@@ -0,0 +1,72 @@
+using Lucene.Net.Index;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexListCfsCommand : ICommand
+ {
+ private readonly bool extract;
+ public IndexListCfsCommand(bool extract)
+ {
+ this.extract = extract;
+ }
+
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => CompoundFileExtractor.Main(args);
+
+ this.Name = "list-cfs";
+ this.Description = FromResource("Description");
+
+ this.Argument("<CFS_FILE_NAME>", FromResource("CFSFileNameDescription"));
+ this.Options.Add(new DirectoryTypeOption());
+
+ this.OnExecute(() => new IndexListCfsCommand(extract: false).Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ var args = new List<string>();
+ if (extract)
+ {
+ args.Add("-extract");
+ }
+
+ var directoryTypeOption = cmd.GetOption<DirectoryTypeOption>();
+ if (directoryTypeOption != null && directoryTypeOption.HasValue())
+ {
+ args.Add("-dir-impl");
+ args.Add(directoryTypeOption.Value());
+ }
+
+ cmd.Main(cmd.GetNonNullArguments().Union(args).ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-list-high-freq-terms/IndexListHighFreqTerms.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-list-high-freq-terms/IndexListHighFreqTerms.cs b/src/tools/lucene-cli/commands/index/index-list-high-freq-terms/IndexListHighFreqTerms.cs
new file mode 100644
index 0000000..ced2b9d
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-list-high-freq-terms/IndexListHighFreqTerms.cs
@@ -0,0 +1,86 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Misc;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexListHighFreqTermsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => HighFreqTerms.Main(args);
+
+ this.Name = "list-high-freq-terms";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument());
+ this.TotalTermFreqOption = this.Option(
+ "-t|--total-term-frequency",
+ FromResource("TotalTermFrequencyDescription"),
+ CommandOptionType.NoValue);
+ this.NumberOfTermsOption = this.Option(
+ "-n|--number-of-terms <NUMBER_OF_TERMS>",
+ FromResource("NumberOfTermsDescription"),
+ CommandOptionType.SingleValue);
+ this.FieldOption = this.Option(
+ "-f|--field <FIELD>",
+ FromResource("FieldDescription"),
+ CommandOptionType.SingleValue);
+
+ this.OnExecute(() => new IndexListHighFreqTermsCommand().Run(this));
+ }
+
+ public virtual CommandOption TotalTermFreqOption { get; private set; }
+ public virtual CommandOption NumberOfTermsOption { get; private set; }
+ public virtual CommandOption FieldOption { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ var args = new List<string>() { cmd.GetArgument<IndexDirectoryArgument>().Value };
+ var input = cmd as Configuration;
+
+ if (input.TotalTermFreqOption != null && input.TotalTermFreqOption.HasValue())
+ {
+ args.Add("-t");
+ }
+
+ if (input.NumberOfTermsOption != null && input.NumberOfTermsOption.HasValue())
+ {
+ args.Add(input.NumberOfTermsOption.Value());
+ }
+
+ if (input.FieldOption != null && input.FieldOption.HasValue())
+ {
+ args.Add(input.FieldOption.Value());
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-list-segments/IndexSegmentListCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-list-segments/IndexSegmentListCommand.cs b/src/tools/lucene-cli/commands/index/index-list-segments/IndexSegmentListCommand.cs
new file mode 100644
index 0000000..ca4d2dc
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-list-segments/IndexSegmentListCommand.cs
@@ -0,0 +1,51 @@
+using Lucene.Net.Index;
+using System.Linq;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexListSegmentsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => IndexSplitter.Main(args);
+
+ this.Name = "list-segments";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument());
+
+ this.OnExecute(() => new IndexListSegmentsCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+
+ cmd.Main(cmd.GetNonNullArguments().Union(new string[] { "-l" }).ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-list-taxonomy-stats/IndexListTaxonomyStatsCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-list-taxonomy-stats/IndexListTaxonomyStatsCommand.cs b/src/tools/lucene-cli/commands/index/index-list-taxonomy-stats/IndexListTaxonomyStatsCommand.cs
new file mode 100644
index 0000000..a0336a6
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-list-taxonomy-stats/IndexListTaxonomyStatsCommand.cs
@@ -0,0 +1,62 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Facet.Taxonomy;
+using System.Collections.Generic;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexListTaxonomyStatsCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => PrintTaxonomyStats.Main(args);
+
+ this.Name = "list-taxonomy-stats";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument());
+ this.ShowTreeOption = this.Option("-tree|--show-tree", FromResource("ShowTreeOption"), CommandOptionType.NoValue);
+
+ this.OnExecute(() => new IndexListTaxonomyStatsCommand().Run(this));
+ }
+
+ public virtual CommandOption ShowTreeOption { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(1))
+ {
+ return 1;
+ }
+ var input = cmd as Configuration;
+ var args = new List<string>() { cmd.GetArgument<IndexDirectoryArgument>().Value };
+
+ if (input.ShowTreeOption != null && input.ShowTreeOption.HasValue())
+ {
+ args.Add("-printTree");
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-list-term-info/IndexListTermInfoCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-list-term-info/IndexListTermInfoCommand.cs b/src/tools/lucene-cli/commands/index/index-list-term-info/IndexListTermInfoCommand.cs
new file mode 100644
index 0000000..780e8d1
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-list-term-info/IndexListTermInfoCommand.cs
@@ -0,0 +1,52 @@
+using Lucene.Net.Misc;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexListTermInfoCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => GetTermInfo.Main(args);
+
+ this.Name = "list-term-info";
+ this.Description = FromResource("Description");
+
+ this.Arguments.Add(new IndexDirectoryArgument(required: true) { Description = FromResource("IndexDirectoryDescription") });
+ this.Argument("<FIELD>", FromResource("FieldDescription"));
+ this.Argument("<TERM>", FromResource("TermDescription"));
+
+ this.OnExecute(() => new IndexListTermInfoCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(3))
+ {
+ return 1;
+ }
+
+ cmd.Main(cmd.GetNonNullArguments());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-merge/IndexMergeCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-merge/IndexMergeCommand.cs b/src/tools/lucene-cli/commands/index/index-merge/IndexMergeCommand.cs
new file mode 100644
index 0000000..a6f1e5e
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-merge/IndexMergeCommand.cs
@@ -0,0 +1,51 @@
+using Lucene.Net.Misc;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexMergeCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => IndexMergeTool.Main(args);
+
+ this.Name = "merge";
+ this.Description = FromResource("Description");
+
+ this.Argument("<OUTPUT_DIRECTORY>", FromResource("OutputDirectoryDescription"));
+ this.Argument("<INPUT_DIRECTORY_1> <INPUT_DIRECTORY_2>[ <INPUT_DIRECTORY_3>...]", FromResource("InputDirectoryDescription"), true);
+
+ this.OnExecute(() => new IndexMergeCommand().Run(this));
+ }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(3))
+ {
+ return 1;
+ }
+
+ cmd.Main(cmd.GetNonNullArguments());
+ return 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9e389540/src/tools/lucene-cli/commands/index/index-split/IndexSplitCommand.cs
----------------------------------------------------------------------
diff --git a/src/tools/lucene-cli/commands/index/index-split/IndexSplitCommand.cs b/src/tools/lucene-cli/commands/index/index-split/IndexSplitCommand.cs
new file mode 100644
index 0000000..80bd2eb
--- /dev/null
+++ b/src/tools/lucene-cli/commands/index/index-split/IndexSplitCommand.cs
@@ -0,0 +1,78 @@
+using Lucene.Net.Cli.CommandLine;
+using Lucene.Net.Index;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Lucene.Net.Cli
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class IndexSplitCommand : ICommand
+ {
+ public class Configuration : ConfigurationBase
+ {
+ public Configuration(CommandLineOptions options)
+ {
+ this.Main = (args) => MultiPassIndexSplitter.Main(args);
+
+ this.Name = "split";
+ this.Description = FromResource("Description");
+
+ this.Argument("<OUTPUT_DIRECTORY>", FromResource("OutputDirectoryDescription"));
+ this.Argument("<INPUT_DIRECTORY>[ <INPUT_DIRECTORY_2>...]", FromResource("InputDirectoryDescription"), true);
+ this.NumberOfParts = this.Option("-n |--number-of-parts <NUMBER>", FromResource("NumberOfPartsDescription"), CommandOptionType.SingleValue);
+ this.Sequential = this.Option("-s|--sequential", FromResource("SequentialDescription"), CommandOptionType.NoValue);
+
+ this.OnExecute(() => new IndexSplitCommand().Run(this));
+ }
+
+ public virtual CommandOption NumberOfParts { get; private set; }
+ public virtual CommandOption Sequential { get; private set; }
+ }
+
+ public int Run(ConfigurationBase cmd)
+ {
+ if (!cmd.ValidateArguments(2))
+ {
+ return 1;
+ }
+
+ // The first argument is the output - we need to use the -out switch
+ var args = new List<string>(cmd.GetNonNullArguments().Skip(1));
+
+ args.Add("-out");
+ args.Add(cmd.GetNonNullArguments().First());
+
+ var input = cmd as Configuration;
+
+ if (input.NumberOfParts != null && input.NumberOfParts.HasValue())
+ {
+ args.Add("-num");
+ args.Add(input.NumberOfParts.Value());
+ }
+
+ if (input.Sequential != null && input.Sequential.HasValue())
+ {
+ args.Add("-seq");
+ }
+
+ cmd.Main(args.ToArray());
+ return 0;
+ }
+ }
+}