Esempio n. 1
0
        public DataTable GetAllDocument(string schemaName, string indexName)
        {
            if (string.IsNullOrEmpty(schemaName))
            {
                throw new NullReferenceException("Şema adı boş geçilemez");
            }
            if (!ExistSchema(schemaName))
            {
                throw new NullReferenceException("Şema bulunamadı");
            }


            if (string.IsNullOrEmpty(indexName))
            {
                throw new NullReferenceException("Index adı boş geçilemez");
            }
            if (!_indexCollection[schemaName].ContainsKey(indexName))
            {
                throw new NullReferenceException("Index bulunamadı");
            }


            var docIndex = new LuceneDocument(Path.Combine(_dataPath, _indexCollection[schemaName][indexName]));

            var result = docIndex.GetAllDocuments();

            docIndex.Dispose();


            return(result);
        }
Esempio n. 2
0
        private void LoadIndexes(LuceneSchema schema)
        {
            var docIndex = new LuceneDocument(Path.Combine(_indexPath, schema.Id));


            _indexCollection.Remove(schema.Name);

            var table = docIndex.GetAllDocuments();

            if (table == null)
            {
                return;
            }

            var indexList = new Dictionary <string, string>();

            foreach (DataRow row in table.Rows)
            {
                indexList.Add(row["name"].ToString(), row["id"].ToString());
            }

            _indexCollection.Add(schema.Name, indexList);


            docIndex.Dispose();
        }