/// <summary>
        /// If the supplied IndexWriter will be written to outside of this instance of LuceneDataProvider,
        /// the <paramref name="transactionLock"/> will be used to coordinate writes.
        /// </summary>
        /// <param name="directory"></param>
        /// <param name="analyzer"></param>
        /// <param name="version"></param>
        /// <param name="indexWriter"></param>
        /// <param name="transactionLock"></param>
        public LuceneDataProvider(Directory directory, Analyzer analyzer, Version version, IIndexWriter indexWriter, object transactionLock)
        {
            this.directory = directory;
            this.analyzer  = analyzer;
            this.version   = version;

            queryParser = RelinqQueryParserFactory.CreateQueryParser();
            context     = new Context(this.directory, this.analyzer, this.version, indexWriter, transactionLock);
        }
示例#2
0
        /// <summary>
        /// Constructs a new instance.
        /// If the supplied IndexWriter will be written to outside of this instance of LuceneDataProvider,
        /// the <paramref name="transactionLock"/> will be used to coordinate writes.
        /// </summary>
        public LuceneDataProvider(Directory directory, Analyzer externalAnalyzer, Version version, IIndexWriter externalWriter, object transactionLock)
        {
            this.directory        = directory;
            this.externalAnalyzer = externalAnalyzer;
            this.perFieldAnalyzer = new PerFieldAnalyzer(new KeywordAnalyzer());
            this.version          = version;
            this.writerIsExternal = externalWriter != null;
            this.writer           = externalWriter ?? IndexWriter;

            queryParser = RelinqQueryParserFactory.CreateQueryParser();
            context     = new Context(this.directory, transactionLock);
        }