/// <summary> /// Create file /// </summary> /// <param name="createNew"> /// if createNew is ture, delete index file and create a new file /// else if FilePath exist, open the index /// </param> public void Create(string fieldName, bool createNew, Hubble.Core.Data.Field.IndexMode indexMode) { _IndexMode = indexMode; _FieldName = fieldName; LoadIndexFiles(createNew); CreateIndexFile(indexMode); }
public IndexWriter(int serial, string path, string fieldName, Hubble.Core.Data.Field.IndexMode indexMode) { _IndexMode = indexMode; _HeadFilePath = Path.AppendDivision(path, '\\') + string.Format("{0:D7}{1}.hdx", serial, fieldName); _DDXFilePath = Path.AppendDivision(path, '\\') + string.Format("{0:D7}{1}.ddx", serial, fieldName); _IndexFilePath = Path.AppendDivision(path, '\\') + string.Format("{0:D7}{1}.idx", serial, fieldName); //_HeadFile = new System.IO.FileStream(_HeadFilePath, System.IO.FileMode.Create, // System.IO.FileAccess.Write); _DDXFile = new DDXFile(_DDXFilePath, DDXFile.Mode.Write); //_IndexFile = new System.IO.FileStream(_IndexFilePath, System.IO.FileMode.Create, // System.IO.FileAccess.Write); _IDXFile = new IDXFile(_IndexFilePath, IDXFile.Mode.Write); }
public IndexReader(int serial, string path, string fieldName, Hubble.Core.Data.Field.IndexMode indexMode, bool readHead) { _IndexMode = indexMode; _Serial = serial; _ReadHead = readHead; if (_ReadHead) { _HeadFilePath = Path.AppendDivision(path, '\\') + string.Format("{0:D7}{1}.hdx", serial, fieldName); } _IndexFilePath = Path.AppendDivision(path, '\\') + string.Format("{0:D7}{1}.idx", serial, fieldName); if (_ReadHead) { //_HeadFile = new System.IO.FileStream(_HeadFilePath, System.IO.FileMode.Open, // System.IO.FileAccess.Read, System.IO.FileShare.Read); } //_IndexFile = IndexFileStreamCache.GetIndexFile(_IndexFilePath); //if (_IndexFile == null) //{ //_IndexFile = new CachedFileStream(new System.IO.FileStream(_IndexFilePath, System.IO.FileMode.Open, // System.IO.FileAccess.Read, System.IO.FileShare.Read)); // _IndexFile = new System.IO.FileStream(_IndexFilePath, System.IO.FileMode.Open, // System.IO.FileAccess.Read, System.IO.FileShare.Read); // IndexFileStreamCache.AddIndexFile(_IndexFilePath, _IndexFile); //} }
public void Create(string fieldName, Hubble.Core.Data.Field.IndexMode indexMode) { Create(fieldName, false, indexMode); }
private void CreateIndexFile(Hubble.Core.Data.Field.IndexMode indexMode) { _IndexWriter = new IndexWriter(_MaxSerial, _Path, FieldName, indexMode); _WordFilePositionList = new List <WordFilePosition>(); }
public IndexReader(int serial, string path, string fieldName, Hubble.Core.Data.Field.IndexMode indexMode) : this(serial, path, fieldName, indexMode, true) { }