/// <summary>
        /// Search and read found records.
        /// </summary>
        public IrbisRecord[] SearchReadSimple
        (
            string key
        )
        {
            int[] mfns = InvertedFile.SearchSimple(key);
            List <IrbisRecord> result = new List <IrbisRecord>();

            foreach (int mfn in mfns)
            {
                try
                {
                    XrfRecord32 xrfRecord = Xrf.ReadRecord(mfn);
                    if (!xrfRecord.Deleted)
                    {
                        MstRecord32 mstRecord = Mst.ReadRecord2(xrfRecord.AbsoluteOffset);
                        if (!mstRecord.Deleted)
                        {
                            IrbisRecord irbisRecord = mstRecord.DecodeRecord();
                            irbisRecord.Database = Database;
                            result.Add(irbisRecord);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                }
            }

            return(result.ToArray());
        }
        private void indexing_button_Click(object sender, EventArgs e)
        {
            if (Docbutton.BackColor == DefaultBackColor)
            {
                MessageBox.Show("Choose Documents ...");
            }
            else
            {
                if (indexing_button.BackColor == DefaultBackColor)
                {
                    indexing_button.BackColor = Color.BurlyWood;
                    ArrayList DocPaths = new ArrayList();
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc0.txt");

                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc1.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc2.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc3.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc4.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc5.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc6.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc7.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc8.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc9.txt");
                    DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc10.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc11.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc12.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc13.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc14.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc15.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc16.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc17.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc18.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc19.txt");
                    //DocPaths.Add(@"D:\Work\Goals\Master\Software\InformationRetrievalSystem\Database\doc20.txt");

                    TextProcessing TP = new TextProcessing(checkBox2.Checked, Stopwords_button.BackColor == Color.BurlyWood, noun_button.BackColor == Color.BurlyWood, stemming_button.BackColor == Color.BurlyWood, true);
                    //TextProcessing TP = new TextProcessing();
                    //you may path file with special format to prevent any one else from treating it.
                    InvertedFile IF = new InvertedFile(TP.Docs_Text_Processing(DocPaths.GetEnumerator()), checkBox5.Checked);
                    IF.createIndex();
                }
                else
                {
                    indexing_button.BackColor = DefaultBackColor;
                }
            }
        }
        //public IrbisRecord ReadRecord2
        //    (
        //        int mfn
        //    )
        //{
        //    XrfRecord64 xrfRecord = Xrf.ReadRecord(mfn);
        //    MstRecord32 mstRecord = Mst.ReadRecord2(xrfRecord.Offset);
        //    IrbisRecord result = mstRecord.DecodeRecord();
        //    result.Database = Database;
        //    return result;
        //}

        /// <summary>
        /// Simple search.
        /// </summary>
        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());
        }
 /// <inheritdoc cref="IDisposable.Dispose"/>
 public void Dispose()
 {
     Mst.Dispose();
     Xrf.Dispose();
     InvertedFile.Dispose();
 }