Пример #1
0
        public static void Save(IFileInfo file, string key, string newContent)
        {
            ContentItem dnnContentItem;

            //if fileObject has already a ContentItem then load it, otherwise create new ContentItem
            if (file.ContentItemID == Null.NullInteger)
            {
                dnnContentItem     = CreateDnnContentItem();
                file.ContentItemID = dnnContentItem.ContentItemId;
            }
            else
            {
                dnnContentItem = CreateDnnContentItem(file.ContentItemID);
            }
            JObject jsonContent = string.IsNullOrEmpty(dnnContentItem.Content) ? new JObject() : JObject.Parse(dnnContentItem.Content);

            if (string.IsNullOrEmpty(newContent))
            {
                jsonContent[key] = new JObject();
            }
            else
            {
                jsonContent[key] = JObject.Parse(newContent);
            }

            dnnContentItem.Content = jsonContent.ToString();
            Util.GetContentController().UpdateContentItem(dnnContentItem);


            //Save to lucene
            var         item        = new OpenFilesInfo(file, dnnContentItem, jsonContent);
            FieldConfig indexConfig = FilesRepository.GetIndexConfig(file.PortalId);

            LuceneController.Instance.Update(LuceneMappingUtils.CreateLuceneItem(item, indexConfig));
            LuceneController.Instance.Store.Commit();

            FileManager.Instance.UpdateFile(file);
        }
Пример #2
0
        public static Query GetDeleteFolderQuery(int portalId, string folderPath)
        {
            var selection = new TermQuery(new Term(LuceneMappingUtils.FolderField, folderPath.TrimEnd('/')));

            return(new FilteredQuery(selection, LuceneMappingUtils.GetTypeTenantFilter(ItemTypeValue, portalId.ToString())));
        }
Пример #3
0
        public static Query GetDeleteQuery(LuceneIndexItem data)
        {
            var selection = new TermQuery(new Term(LuceneMappingUtils.GetIndexFieldName(), LuceneMappingUtils.GetIndexFieldValue(data)));

            return(new FilteredQuery(selection, LuceneMappingUtils.GetTypeTenantFilter(ItemTypeValue, data.PortalId.ToString())));
        }