예제 #1
0
        /// <summary> 创建索引 </summary>
        public void IndexData(List <StandardModel> list)
        {
            MetadataCollection collection = new MetadataCollection();

            foreach (var item in list)
            {
                Metadata metadata    = new Metadata();
                var      resourcekey = "勘探知识库\\标准规范\\外部链接\\" + item.Id;
                metadata.IIId             = resourcekey.ToMD5();
                metadata.IndexedDate      = DateTime.Now;
                metadata.Thumbnail        = null;
                metadata.Fulltext         = null;
                metadata.PageId           = "23";
                metadata.DataId           = item.Url;
                metadata["dsn"]           = "勘探知识库";
                metadata.ShowType         = IndexShowType.Mixing.ToString();
                metadata["title"]         = item.Name;
                metadata["subject"]       = null;
                metadata["abstract"]      = item.Name;
                metadata["catalogue"]     = item.Type;
                metadata["author"]        = null;
                metadata["submitter"]     = null;
                metadata["auditor"]       = null;
                metadata["createddate"]   = null;
                metadata["submitteddate"] = null;
                metadata["auditteddate"]  = null;
                metadata["status"]        = "已审核";
                metadata["frequency"]     = null;
                metadata["period"]        = null;
                metadata["basin"]         = null;
                metadata["firstlevel"]    = null;
                metadata["secondlevel"]   = null;
                metadata["trap"]          = null;
                metadata["well"]          = null;
                metadata["swa"]           = null;
                metadata["miningarea"]    = null;
                metadata["cozone"]        = null;
                metadata["project"]       = null;
                metadata["pc"]            = item.Type;
                metadata["pt"]            = "标准规范";
                metadata["bd"]            = "勘探";
                metadata["bt"]            = "标准规范";
                metadata["bp"]            = item.Type;
                metadata["ba"]            = null;
                metadata["bf"]            = null;
                metadata["system"]        = "勘探知识库";
                metadata["resourcetype"]  = "勘探知识库\\标准规范\\外部链接\\" + item.Type;
                metadata["resourcekey"]   = resourcekey;

                collection.Add(metadata);
            }
            if (collection.Count() > 0)
            {
                IndexSaveRequest indexrequest = new IndexSaveRequest()
                {
                    Replace   = true,
                    Metadatas = collection
                };
                var iiids      = _indexService.Save(indexrequest);
                var indexCount = iiids.Count();
            }
        }