public IrbisDirectIO ( string masterFile, bool write ) { Database = Path.GetFileNameWithoutExtension(masterFile); Mst = new MstFile ( Path.ChangeExtension ( masterFile, ".mst" ), write ); Xrf = new XrfFile ( Path.ChangeExtension ( masterFile, ".xrf" ), write ); InvertedFile = new InvertedFile ( Path.ChangeExtension ( masterFile, ".ifp" ), write ); }
public IrbisDirectReader ( string masterFile, bool inMemory ) { Database = Path.GetFileNameWithoutExtension(masterFile); Mst = new MstFile ( Path.ChangeExtension ( masterFile, ".mst" ) ); Xrf = new XrfFile ( Path.ChangeExtension ( masterFile, ".xrf" ), inMemory ); InvertedFile = new InvertedFile ( Path.ChangeExtension ( masterFile, ".ifp" ) ); }
public IrbisRecord[] SearchReadSimple(string key) { int[] mfns = InvertedFile.SearchSimple(key); List <IrbisRecord> result = new List <IrbisRecord>(); foreach (int mfn in mfns) { try { XrfRecord xrfRecord = Xrf.ReadRecord(mfn); if (!xrfRecord.Deleted) { MstRecord mstRecord = Mst.ReadRecord2(xrfRecord.Offset); if (!mstRecord.Deleted) { IrbisRecord irbisRecord = mstRecord.DecodeRecord(); irbisRecord.Database = Database; result.Add(irbisRecord); } } } catch (Exception ex) { Debug.WriteLine(ex); } } return(result.ToArray()); }
//public IrbisRecord ReadRecord2 // ( // int mfn // ) //{ // XrfRecord xrfRecord = Xrf.ReadRecord(mfn); // MstRecord mstRecord = Mst.ReadRecord2(xrfRecord.Offset); // IrbisRecord result = mstRecord.DecodeRecord(); // result.Database = Database; // return result; //} public int[] SearchSimple(string key) { int[] mfns = InvertedFile.SearchSimple(key); List <int> result = new List <int>(); foreach (int mfn in mfns) { if (!Xrf.ReadRecord(mfn).Deleted) { result.Add(mfn); } } return(result.ToArray()); }
public void OpenDb(string db, bool write) { var masterFile = Irbis64Config.LookupDbMst(db); Database = db; Database = Path.GetFileNameWithoutExtension(masterFile); if (Mst != null) { Mst.Dispose(); } if (Xrf != null) { Xrf.Dispose(); } if (InvertedFile != null) { InvertedFile.Dispose(); } Mst = new MstFile ( Path.ChangeExtension ( masterFile, ".mst" ), write ); Xrf = new XrfFile ( Path.ChangeExtension ( masterFile, ".xrf" ), write ); InvertedFile = new InvertedFile ( Path.ChangeExtension ( masterFile, ".ifp" ), write ); }
public void Dispose() { if (Mst != null) { Mst.Dispose(); Mst = null; } if (Xrf != null) { Xrf.Dispose(); Xrf = null; } if (InvertedFile != null) { InvertedFile.Dispose(); InvertedFile = null; } }
public TermLink[] GetTermLinks(SearchTermInfo term, int first, int limit) { return(InvertedFile.GetTermLinks(term, first, limit)); }
public SearchTermInfo[] SearchTermsFrom(string key, bool searchBack, int limit) { return(InvertedFile.SearchTermsFrom(key, searchBack, limit)); }
public SearchTermInfo[] SearchTermsStart(string key, int limit) { return(InvertedFile.SearchTermsStart(key, limit)); }
public SearchTermInfo SearchTermExact(string key) { return(InvertedFile.SearchTermExact(key)); }
public TermLink[] SearchRange(string keyA, string keyB) { return(InvertedFile.SearchRange(keyA, keyB)); }
public TermLink[] SearchStart(string key) { return(InvertedFile.SearchStart(key)); }
public TermLink[] SearchExact(string key, int first, int limit) { return(InvertedFile.SearchExact(key, first, limit)); }
/// <summary> /// ibatrak инициализация базы данных /// </summary> public void InitDatabase() { Mst.Create(); Xrf.Create(); InvertedFile.Create(); }