Esempio n. 1
0
        public string FullText(
            Context context,
            SiteSettings ss,
            bool backgroundTask = false,
            bool onCreating     = false)
        {
            if (Parameters.Search.Provider != "FullText")
            {
                return(null);
            }
            if (!Parameters.Search.CreateIndexes && !backgroundTask)
            {
                return(null);
            }
            if (AccessStatus == Databases.AccessStatuses.NotFound)
            {
                return(null);
            }
            var fullText = new List <string>();

            SiteInfo.TenantCaches
            .Get(context.TenantId)?
            .SiteMenu.Breadcrumb(context: context, siteId: SiteId)
            .FullText(context, fullText);
            SiteId.FullText(context, fullText);
            ss.EditorColumns.ForEach(columnName =>
            {
                switch (columnName)
                {
                case "WikiId":
                    WikiId.FullText(context, fullText);
                    break;

                case "Title":
                    Title.FullText(context, fullText);
                    break;

                case "Body":
                    Body.FullText(context, fullText);
                    break;

                case "Comments":
                    Comments.FullText(context, fullText);
                    break;
                }
            });
            Creator.FullText(context, fullText);
            Updator.FullText(context, fullText);
            CreatedTime.FullText(context, fullText);
            UpdatedTime.FullText(context, fullText);
            if (!onCreating)
            {
                FullTextExtensions.OutgoingMailsFullText(
                    context: context,
                    fullText: fullText,
                    referenceType: "Wikis",
                    referenceId: WikiId);
            }
            return(fullText
                   .Where(o => !o.IsNullOrEmpty())
                   .Select(o => o.Trim())
                   .Distinct()
                   .Join(" "));
        }