Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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.DeletePriorCommitsOption != null && input.DeletePriorCommitsOption.HasValue())
            {
                args.Add("-delete-prior-commits");
            }

            // get vebose option
            var verboseOption = cmd.GetOption <VerboseOption>();

            if (verboseOption != null && verboseOption.HasValue())
            {
                args.Add("-verbose");
            }

            var directoryTypeOption = cmd.GetOption <DirectoryTypeOption>();

            if (directoryTypeOption != null && directoryTypeOption.HasValue())
            {
                args.Add("-dir-impl");
                args.Add(directoryTypeOption.Value());
            }

            cmd.Main(args.ToArray());
            return(0);
        }