예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Collection" /> class.
        /// </summary>
        /// <param name="name">The name of the Document Collection.</param>
        /// <param name="database">The database.</param>
        /// <param name="schema">The schema.</param>
        /// <exception cref="System.ArgumentException"></exception>
        /// <exception cref="System.ArgumentNullException"></exception>
        internal Collection(string name, Database database, Schema schema = null)
        {
            if (String.IsNullOrWhiteSpace(name))
                throw new ArgumentException($"{nameof(name)} cannot be null or blank");
            if (database == null)
                throw new ArgumentNullException(nameof(database));

            Name = name;
            Schema = schema ?? Schema.CreateDefault(name);

            _documentStorage = database.DocumentStorage;            

            var indexPath = Path.Combine(database.IndexBasePath, name);
            _luceneIndex = new LuceneIndex(indexPath, Schema);            
        }        
예제 #2
0
        public void Initialize()
        {
            _appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            _indexPath = Path.Combine(_appPath, "index");

            if (Directory.Exists(_indexPath))
                Directory.Delete(_indexPath, true);

            _luceneIndex = new LuceneIndex(_indexPath, Schema.CreateDefault());
        }