Ejemplo n.º 1
0
 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
                    );
 }
Ejemplo n.º 2
0
 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"
         )
                    );
 }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        //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());
        }
Ejemplo n.º 5
0
        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
                           );
        }
Ejemplo n.º 6
0
 public void Dispose()
 {
     if (Mst != null)
     {
         Mst.Dispose();
         Mst = null;
     }
     if (Xrf != null)
     {
         Xrf.Dispose();
         Xrf = null;
     }
     if (InvertedFile != null)
     {
         InvertedFile.Dispose();
         InvertedFile = null;
     }
 }
Ejemplo n.º 7
0
 public TermLink[] GetTermLinks(SearchTermInfo term, int first, int limit)
 {
     return(InvertedFile.GetTermLinks(term, first, limit));
 }
Ejemplo n.º 8
0
 public SearchTermInfo[] SearchTermsFrom(string key, bool searchBack, int limit)
 {
     return(InvertedFile.SearchTermsFrom(key, searchBack, limit));
 }
Ejemplo n.º 9
0
 public SearchTermInfo[] SearchTermsStart(string key, int limit)
 {
     return(InvertedFile.SearchTermsStart(key, limit));
 }
Ejemplo n.º 10
0
 public SearchTermInfo SearchTermExact(string key)
 {
     return(InvertedFile.SearchTermExact(key));
 }
Ejemplo n.º 11
0
 public TermLink[] SearchRange(string keyA, string keyB)
 {
     return(InvertedFile.SearchRange(keyA, keyB));
 }
Ejemplo n.º 12
0
 public TermLink[] SearchStart(string key)
 {
     return(InvertedFile.SearchStart(key));
 }
Ejemplo n.º 13
0
 public TermLink[] SearchExact(string key, int first, int limit)
 {
     return(InvertedFile.SearchExact(key, first, limit));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// ibatrak инициализация базы данных
 /// </summary>
 public void InitDatabase()
 {
     Mst.Create();
     Xrf.Create();
     InvertedFile.Create();
 }