コード例 #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
                    );
 }
コード例 #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"
         )
                    );
 }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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
                           );
        }
コード例 #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;
     }
 }
コード例 #7
0
 public TermLink[] GetTermLinks(SearchTermInfo term, int first, int limit)
 {
     return(InvertedFile.GetTermLinks(term, first, limit));
 }
コード例 #8
0
 public SearchTermInfo[] SearchTermsFrom(string key, bool searchBack, int limit)
 {
     return(InvertedFile.SearchTermsFrom(key, searchBack, limit));
 }
コード例 #9
0
 public SearchTermInfo[] SearchTermsStart(string key, int limit)
 {
     return(InvertedFile.SearchTermsStart(key, limit));
 }
コード例 #10
0
 public SearchTermInfo SearchTermExact(string key)
 {
     return(InvertedFile.SearchTermExact(key));
 }
コード例 #11
0
 public TermLink[] SearchRange(string keyA, string keyB)
 {
     return(InvertedFile.SearchRange(keyA, keyB));
 }
コード例 #12
0
 public TermLink[] SearchStart(string key)
 {
     return(InvertedFile.SearchStart(key));
 }
コード例 #13
0
 public TermLink[] SearchExact(string key, int first, int limit)
 {
     return(InvertedFile.SearchExact(key, first, limit));
 }
コード例 #14
0
 /// <summary>
 /// ibatrak инициализация базы данных
 /// </summary>
 public void InitDatabase()
 {
     Mst.Create();
     Xrf.Create();
     InvertedFile.Create();
 }