//public LuceneIndexTransform()
        //{

        //}

        public void Transform(string inputPath, string outputPath, Dictionary <string, string> fieldNameTransformDictionary,
                              Dictionary <string, Func <string, string> > fieldValueTransformDictionary = null, Func <Document, bool> documentPredicate = null)
        {
            if (fieldValueTransformDictionary == null)
            {
                fieldValueTransformDictionary = new Dictionary <string, Func <string, string> >();
            }
            if (documentPredicate == null)
            {
                documentPredicate = document => true;
            }

            Func <string, string> defaultValueTransformFunc = str => str;

            LuceneOperations.EnumerateIndexReaderWriter(inputPath, outputPath, (inDoc, indexWriter) =>
            {
                if (documentPredicate(inDoc))
                {
                    var outDoc = new Document();
                    foreach (var kvp in fieldNameTransformDictionary)
                    {
                        var inFieldName = kvp.Key;
                        var inValue     = inDoc.Get(inFieldName);
                        if (inValue != null)
                        {
                            var outFieldName = kvp.Value;
                            Func <string, string> valueTransformFunc;
                            if (!fieldValueTransformDictionary.TryGetValue(inFieldName, out valueTransformFunc))
                            {
                                valueTransformFunc = defaultValueTransformFunc;
                            }
                            LuceneOperations.AddField(outDoc, outFieldName, valueTransformFunc(inValue));
                        }
                    }
                    indexWriter.AddDocument(outDoc);
                }
            });
        }