예제 #1
0
파일: IndexFile.cs 프로젝트: wj60387/hubble
        /// <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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            //}
        }
예제 #4
0
파일: IndexFile.cs 프로젝트: wj60387/hubble
 public void Create(string fieldName, Hubble.Core.Data.Field.IndexMode indexMode)
 {
     Create(fieldName, false, indexMode);
 }
예제 #5
0
파일: IndexFile.cs 프로젝트: wj60387/hubble
        private void CreateIndexFile(Hubble.Core.Data.Field.IndexMode indexMode)
        {
            _IndexWriter = new IndexWriter(_MaxSerial, _Path, FieldName, indexMode);

            _WordFilePositionList = new List <WordFilePosition>();
        }
예제 #6
0
 public IndexReader(int serial, string path, string fieldName, Hubble.Core.Data.Field.IndexMode indexMode)
     : this(serial, path, fieldName, indexMode, true)
 {
 }