public static IEnumerable <IToken> Parse(this ILexerFactory factory, TextReader input)
        {
            var lexer = factory.CreateLexer();

            lexer.Reset(input);

            while (lexer.MoveNext())
            {
                yield return(lexer.Current);
            }
        }
        public LuceneIndexEngine(
            string indexDirectory      = null,
            ILexerFactory lexerFactory = null)
        {
            IndexDirectory = indexDirectory ?? "lucene-index";

            lexerFactory    = lexerFactory ?? new DefaultLexerFactory();
            _writerLexer    = lexerFactory.CreateLexer();
            _writerAnalyzer = new GenericAnalyzer(_writerLexer);

            QueryBuilder = new LuceneQueryBuilder(lexerFactory, ContentFieldName);
        }