public IndexStorage(string path, IndexDefinitionStorage indexDefinitionStorage)
{
this.path = Path.Combine(path, "Index");
if (Directory.Exists(this.path) == false)
Directory.CreateDirectory(this.path);
log.DebugFormat("Initializing index storage at {0}", this.path);
foreach (var indexDirectory in Directory.GetDirectories(this.path))
{
log.DebugFormat("Loading saved index {0}", indexDirectory);
var name = Path.GetFileName(indexDirectory);
name = HttpUtility.UrlDecode(name);
var indexDefinition = indexDefinitionStorage.GetIndexDefinition(name);
if(indexDefinition == null)
continue;
var fsDirectory = FSDirectory.GetDirectory(indexDirectory, false);
indexes.TryAdd(name, CreateIndexImplementation(name, indexDefinition, fsDirectory));
}
}