Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CSearchDAL searchEngine = new CSearchDAL();
            string     rootPath     = MidLayerSettings.AppPath;

            if (rootPath[rootPath.Length - 1] != '\\')
            {
                rootPath += "\\";
            }
            searchEngine.ReIndexFolder(rootPath);
            MessageBox.Show("成功重建索引!", "文档管理系统", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 2
0
        public COrganizeEntity CreateOrganize(String organizeName)
        {
            try
            {
                // create resource for this organize
                CResourceEntity res = new CResourceEntity(_connString);
                res.Res_Name   = _orgName;
                res.Res_Parent = 0;
                res.Res_Type   = (int)RESOURCETYPE.ORGANIZERESOURCE;
                res.Res_Id     = res.Insert();

                // create default storage folder named as organize resource id
                String organizePath = System.IO.Path.Combine(_path, res.Res_Id.ToString() + _orgName);
                Directory.CreateDirectory(organizePath);
                _rootPath = organizePath;
                CSearchDAL.AddSearchFolder(_rootPath);

                // create resource for default folder of organize
                CResourceEntity folderRes = new CResourceEntity(_connString);
                folderRes.Res_Name   = res.Res_Id.ToString() + _orgName;
                folderRes.Res_Parent = 0;
                folderRes.Res_Type   = (int)RESOURCETYPE.FOLDERRESOURCE;
                folderRes.Res_Id     = folderRes.Insert();

                // Create organize entity
                COrganizeEntity organize = new COrganizeEntity(_connString);
                organize.Org_Name     = _orgName;
                organize.Org_Resource = folderRes.Res_Id;
                organize.Insert();

                // create archive folder for organzie
                String archivePath = System.IO.Path.Combine(organizePath, "归档目录");
                Directory.CreateDirectory(archivePath);

                // create resource for archive folder
                CResourceEntity archiveRes = new CResourceEntity(_connString);
                archiveRes.Res_Name   = "归档目录";
                archiveRes.Res_Parent = folderRes.Res_Id;
                archiveRes.Res_Type   = (int)RESOURCETYPE.FOLDERRESOURCE;
                archiveRes.Res_Id     = archiveRes.Insert();

                organize.Org_ArchiveRes = archiveRes.Res_Id;
                organize.Update();

                return(organize);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Ejemplo n.º 3
0
        public void SearchFullText(String text, String path)
        {
            String scope = path;

            if (scope[scope.Length - 1] == '\\')
            {
                scope = scope.Substring(0, scope.Length - 1);
            }
            scope = scope.Replace('\\', '/');

            CSearchDAL searchEngine             = new CSearchDAL();
            List <CSearchResultItem> tempResult = searchEngine.SearchFolder(text, scope);

            if (tempResult.Count > 0)
            {
                _result.AddRange(tempResult);
            }
        }