Beispiel #1
0
 public static bool 更新政策法规(政策法规 content,bool flage=true)
 {
     return Mongo.更新(content,flage);
 }
Beispiel #2
0
 public static bool 添加政策法规(政策法规 content)
 {
     return Mongo.添加(content);
 }
        public ActionResult Part_ZcfgSearch()
        {
            ViewData["searchtext"] = Request.Form["searchtext"];

            TopDocs serchalllist = SearchIndex("/Lucene.Net/IndexDic/Zcfg", Request.Form["searchtext"]);
            int page = 1;
            ViewData["currentpage"] = page;
            ViewData["pagecount"] = page;

            IList<政策法规> serchlist = new List<政策法规>();
            var listcount = serchalllist.totalHits > 1000 ? 1000 : serchalllist.totalHits;
            if (serchalllist != null && listcount > 0)
            {
                int maxpage = Math.Max((listcount + PAGESIZE - 1) / PAGESIZE, 1);

                int length = PAGESIZE;
                if (maxpage == page && listcount % PAGESIZE != 0)
                    length = listcount % PAGESIZE;

                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("title", Request.Form["searchtext"]);
                //IndexSearcher search = new IndexSearcher(IndexDic("/Lucene.Net/IndexDic/Zcfg"), true);
                IndexSearcher search = new IndexSearcher(new Lucene.Net.Store.SimpleFSDirectory(new System.IO.DirectoryInfo(IndexDic("/Lucene.Net/IndexDic/Zcfg"))), true);
                for (int i = 0; i < length; i++)
                {
                    政策法规 model = new 政策法规();
                    model.Id = long.Parse(search.Doc(serchalllist.scoreDocs[i].doc).Get("NumId"));
                    model.内容主体.标题 = search.Doc(serchalllist.scoreDocs[i].doc).Get("Title");
                    model.内容主体.发布时间 = Convert.ToDateTime(search.Doc(serchalllist.scoreDocs[i].doc).Get("AddTime"));
                    serchlist.Add(SetHighlighter(dic, model));
                }
                //ViewData["currentpage"] = page;
                ViewData["pagecount"] = maxpage;
            }
            ViewData["政策法规搜索显示列表"] = serchlist;

            return PartialView("Part_Zcfg/Part_ZcfgSearch");
        }
        public ActionResult Part_Procure_ZcfgList_AuditDetail(int? id)
        {
            政策法规 g = new 政策法规();
            if (null != id)
            {
                g = 政策法规管理.查找政策法规((long)id);
            }

            return PartialView("Procure_Part/Part_Procure_ZcfgList_AuditDetail", g);
        }
 /// <summary>
 /// 设置关键字高亮
 /// </summary>
 /// <param name="dicKeywords">关键字列表</param>
 /// <param name="model">返回的数据模型</param>
 /// <returns></returns>
 private 政策法规 SetHighlighter(Dictionary<string, string> dicKeywords, 政策法规 model)
 {
     SimpleHTMLFormatter simpleHTMLFormatter = new PanGu.HighLight.SimpleHTMLFormatter("<font color=\"red\">", "</font>");
     Highlighter highlighter = new PanGu.HighLight.Highlighter(simpleHTMLFormatter, new Segment());
     highlighter.FragmentSize = 50;
     string strTitle = string.Empty;
     dicKeywords.TryGetValue("title", out strTitle);
     if (!string.IsNullOrEmpty(strTitle))
     {
         string title = highlighter.GetBestFragment(strTitle, model.内容主体.标题);
         if (!string.IsNullOrEmpty(title))
             model.内容主体.标题 = title;
     }
     return model;
 }