19 using System.Collections;
20 using System.Collections.Generic;
21 using System.Collections.Specialized;
22 using System.Configuration;
25 using Lucene.Net.Distributed;
26 using Lucene.Net.Distributed.Configuration;
28 namespace Lucene.Net.Distributed.Indexing
52 private bool _bCompoundFile;
53 private string _strDeltaDirectory;
61 get {
return (
IndexSets)ConfigurationManager.GetSection(
"IndexSets"); }
68 public void LoadIndexSetArray(XmlNode node)
70 XmlAttributeCollection attributeCollection = node.Attributes;
74 this._bCompoundFile = Convert.ToBoolean(attributeCollection[
"CompoundFile"].Value);
78 throw new ConfigurationErrorsException(
"CompoundFile invalid: " + Environment.NewLine + node.OuterXml);
83 this._strDeltaDirectory = attributeCollection[
"DeltaDirectory"].Value;
87 throw new ConfigurationErrorsException(
"DeltaDirectory invalid: " + Environment.NewLine + node.OuterXml);
90 if (node.ChildNodes.Count == 0)
91 throw new ConfigurationErrorsException(
"No indexset definitions found " + Environment.NewLine + node.OuterXml);
92 this._arIndexSet =
new IndexSet[node.ChildNodes.Count];
95 foreach (XmlNode c
in node.ChildNodes)
97 if (c.Name.ToLower()==
"IndexSet")
100 this._arIndexSet[x] = idxSet;
118 public bool CompoundFile
120 get {
return this._bCompoundFile;}
126 public string DeltaDirectory
128 get {
return this._strDeltaDirectory;}
136 get {
return this._arIndexSet;}
147 foreach(
IndexSet idxSet
in this._arIndexSet)
162 public void LoadIndexDocuments(
string sourceDir)
164 DirectoryInfo oDirectoryInfo =
new DirectoryInfo(sourceDir);
165 FileInfo[] arFiles = oDirectoryInfo.GetFiles(
"*.bin");
169 foreach (FileInfo fi
in arFiles)
171 FileStream fs =
new FileStream(fi.FullName, FileMode.Open);
174 idxSet = this.GetIndexSet(iDoc.RecordId);
189 if (ConfigurationManager.AppSettings[
"ExceptionsBasePath"] != null)
190 iDoc.Save(ConfigurationManager.AppSettings[
"ExceptionsBasePath"]);
201 public void ProcessIndexDocuments()
203 foreach(
IndexSet idxSet
in this._arIndexSet)
216 public void CopyUpdatedFiles()
218 Hashtable htUpdates =
new Hashtable();
220 foreach (
IndexSet idxSet
in this._arIndexSet)
229 foreach(DictionaryEntry de
in htUpdates)
231 string sTargetDir = de.Key.ToString();
241 public Hashtable CopyAllFiles()
243 Hashtable htUpdates =
new Hashtable();
245 foreach (
IndexSet idxSet
in this._arIndexSet)
254 foreach (DictionaryEntry de
in htUpdates)
256 string sTargetDir = de.Key.ToString();
267 public void OptimizeIndexes()
269 foreach (
IndexSet idxSet
in this._arIndexSet)
276 public void CompleteUpdate()
278 foreach (
IndexSet idxSet
in this._arIndexSet)
284 FileInfo fi =
new FileInfo(s);