Example #1
0
        private static SueetieSearchDoc ConvertSueetieMediaObjectToSearchDoc(SueetieMediaObject sueetieMediaObject)
        {
            string _body        = string.IsNullOrEmpty(sueetieMediaObject.MediaObjectDescription) ? sueetieMediaObject.MediaObjectTitle : sueetieMediaObject.MediaObjectDescription;
            string _tags        = !string.IsNullOrEmpty(sueetieMediaObject.Tags) ? sueetieMediaObject.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(sueetieMediaObject.Tags) ? SueetieTags.TagUrls(sueetieMediaObject.Tags) : string.Empty;

            SueetieSearchDoc doc = new SueetieSearchDoc()
            {
                App               = "Media",
                ContentID         = sueetieMediaObject.ContentID,
                Title             = sueetieMediaObject.MediaObjectTitle,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieMediaObject.ApplicationID,
                IsRestricted      = sueetieMediaObject.IsRestricted,
                PublishDate       = sueetieMediaObject.DateTimeCreated,
                ContainerName     = sueetieMediaObject.AlbumTitle,
                GroupID           = sueetieMediaObject.GroupID,
                GroupKey          = string.IsNullOrEmpty(sueetieMediaObject.GroupKey) ? "na" : sueetieMediaObject.GroupKey,
                ContentTypeID     = sueetieMediaObject.ContentTypeID,
                Categories        = string.Empty,
                ApplicationTypeID = sueetieMediaObject.ApplicationTypeID,
                ApplicationKey    = sueetieMediaObject.ApplicationKey,
                PermaLink         = "/" + sueetieMediaObject.ApplicationKey + "/default.aspx?moid=" + sueetieMediaObject.MediaObjectID,
                Author            = sueetieMediaObject.DisplayName,
                Username          = sueetieMediaObject.UserName,
                Body              = _body + RaquoIt(sueetieMediaObject.MediaObjectTitle) + RaquoIt(_tags) + RaquoIt(sueetieMediaObject.UserName)
            };

            return(doc);
        }
Example #2
0
        private static SueetieSearchDoc ConvertSueetieMediaAlbumToSearchDoc(SueetieMediaAlbum sueetieMediaAlbum)
        {
            string _body        = sueetieMediaAlbum.AlbumTitle;
            string _tags        = !string.IsNullOrEmpty(sueetieMediaAlbum.Tags) ? sueetieMediaAlbum.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(sueetieMediaAlbum.Tags) ? SueetieTags.TagUrls(sueetieMediaAlbum.Tags) : string.Empty;

            SueetieSearchDoc doc = new SueetieSearchDoc()
            {
                App               = "Albums",
                ContentID         = sueetieMediaAlbum.ContentID,
                Title             = sueetieMediaAlbum.AlbumTitle,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieMediaAlbum.ApplicationID,
                IsRestricted      = sueetieMediaAlbum.IsRestricted,
                PublishDate       = sueetieMediaAlbum.DateTimeCreated,
                ContainerName     = sueetieMediaAlbum.ApplicationDescription,
                GroupID           = sueetieMediaAlbum.GroupID,
                GroupKey          = string.IsNullOrEmpty(sueetieMediaAlbum.GroupKey) ? "na" : sueetieMediaAlbum.GroupKey,
                ContentTypeID     = sueetieMediaAlbum.ContentTypeID,
                Categories        = string.Empty,
                ApplicationTypeID = sueetieMediaAlbum.ApplicationTypeID,
                ApplicationKey    = sueetieMediaAlbum.ApplicationKey,
                PermaLink         = sueetieMediaAlbum.Permalink,
                Author            = sueetieMediaAlbum.DisplayName,
                Username          = sueetieMediaAlbum.UserName,
                Body              = _body + RaquoIt(_tags) + RaquoIt(sueetieMediaAlbum.UserName)
            };

            return(doc);
        }
Example #3
0
        private static SueetieSearchDoc ConvertSueetieForumMessageToSearchDoc(SueetieForumMessage sueetieForumMessage)
        {
            string _body        = DataHelper.CleanSearchBodyContent(sueetieForumMessage.Message);
            string _tags        = !string.IsNullOrEmpty(sueetieForumMessage.Tags) ? sueetieForumMessage.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(sueetieForumMessage.Tags) ? SueetieTags.TagUrls(sueetieForumMessage.Tags) : string.Empty;

            SueetieSearchDoc doc = new SueetieSearchDoc()
            {
                App               = "Forums",
                ContentID         = sueetieForumMessage.ContentID,
                Title             = sueetieForumMessage.Topic,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieForumMessage.ApplicationID,
                IsRestricted      = sueetieForumMessage.IsRestricted,
                PublishDate       = sueetieForumMessage.DateTimeCreated,
                ContainerName     = sueetieForumMessage.Forum,
                GroupID           = sueetieForumMessage.GroupID,
                GroupKey          = string.IsNullOrEmpty(sueetieForumMessage.GroupKey) ? "na" : sueetieForumMessage.GroupKey,
                ContentTypeID     = sueetieForumMessage.ContentTypeID,
                Categories        = string.Empty,
                ApplicationTypeID = sueetieForumMessage.ApplicationTypeID,
                ApplicationKey    = sueetieForumMessage.ApplicationKey,
                PermaLink         = sueetieForumMessage.Permalink,
                Author            = sueetieForumMessage.DisplayName,
                Username          = sueetieForumMessage.UserName,
                Body              = _body + RaquoIt(sueetieForumMessage.Topic) + RaquoIt(_tags) + RaquoIt(sueetieForumMessage.UserName)
            };

            return(doc);
        }
Example #4
0
        private static SueetieSearchDoc ConvertSueetieContentPageToSearchDoc(SueetieContentPage sueetieContentPage)
        {
            string _body        = DataHelper.StripHtml(sueetieContentPage.SearchBody).TrimStart();
            string _tags        = !string.IsNullOrEmpty(sueetieContentPage.Tags) ? sueetieContentPage.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(sueetieContentPage.Tags) ? SueetieTags.TagUrls(sueetieContentPage.Tags) : string.Empty;

            SueetieSearchDoc doc = new SueetieSearchDoc()
            {
                App               = "CMS",
                ContentID         = sueetieContentPage.ContentID,
                Title             = sueetieContentPage.PageTitle,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieContentPage.ApplicationID,
                IsRestricted      = sueetieContentPage.IsRestricted,
                PublishDate       = sueetieContentPage.LastUpdateDateTime,
                ContainerName     = sueetieContentPage.ApplicationName,
                GroupID           = 0,
                GroupKey          = "na",
                ContentTypeID     = sueetieContentPage.ContentTypeID,
                Categories        = string.Empty,
                ApplicationTypeID = sueetieContentPage.ApplicationTypeID,
                ApplicationKey    = sueetieContentPage.ApplicationKey,
                PermaLink         = sueetieContentPage.Permalink,
                Author            = sueetieContentPage.DisplayName,
                Username          = sueetieContentPage.UserName,
                Body              = _body + RaquoIt(sueetieContentPage.PageTitle) + RaquoIt(_tags) + RaquoIt(sueetieContentPage.UserName)
            };

            return(doc);
        }
Example #5
0
        private static SueetieSearchDoc ConvertSueetieWikiPageToSearchDoc(SueetieWikiPage sueetieWikiPage)
        {
            string           _body        = sueetieWikiPage.PageContent;
            string           _tags        = !string.IsNullOrEmpty(sueetieWikiPage.Tags) ? sueetieWikiPage.Tags.Replace('|', ' ') : string.Empty;
            string           _displayTags = !string.IsNullOrEmpty(sueetieWikiPage.Tags) ? SueetieTags.TagUrls(sueetieWikiPage.Tags) : string.Empty;
            string           _keywords    = !string.IsNullOrEmpty(sueetieWikiPage.Keywords) ? sueetieWikiPage.Keywords.Replace(',', ' ') : string.Empty;
            string           _categories  = !string.IsNullOrEmpty(sueetieWikiPage.Categories) ? sueetieWikiPage.Categories.Replace('|', ' ') : string.Empty;
            SueetieSearchDoc doc          = new SueetieSearchDoc()
            {
                App               = "Wikis",
                ContentID         = sueetieWikiPage.ContentID,
                Title             = sueetieWikiPage.PageTitle,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                AppID             = sueetieWikiPage.ApplicationID,
                IsRestricted      = sueetieWikiPage.IsRestricted,
                PublishDate       = sueetieWikiPage.DateTimeModified,
                ContainerName     = sueetieWikiPage.ApplicationName,
                GroupID           = sueetieWikiPage.GroupID,
                GroupKey          = string.IsNullOrEmpty(sueetieWikiPage.GroupKey) ? "na" : sueetieWikiPage.GroupKey,
                ContentTypeID     = sueetieWikiPage.ContentTypeID,
                Categories        = _categories,
                ApplicationTypeID = sueetieWikiPage.ApplicationTypeID,
                ApplicationKey    = sueetieWikiPage.ApplicationKey,
                PermaLink         = sueetieWikiPage.Permalink,
                Author            = sueetieWikiPage.DisplayName,
                Username          = sueetieWikiPage.UserName,
                Body              = _body + RaquoIt(sueetieWikiPage.PageTitle) + RaquoIt(_categories) + RaquoIt(_tags) + RaquoIt(_keywords) + RaquoIt(sueetieWikiPage.UserName)
            };

            return(doc);
        }
Example #6
0
        private static SueetieSearchDoc ConvertBlogPostToSearchDoc(SueetieBlogPost post)
        {
            string _tags        = !string.IsNullOrEmpty(post.Tags) ? post.Tags.Replace('|', ' ') : string.Empty;
            string _displayTags = !string.IsNullOrEmpty(post.Tags) ? SueetieTags.TagUrls(post.Tags) : string.Empty;
            string _categories  = !string.IsNullOrEmpty(post.Categories) ? post.Categories.Replace('|', ' ') : string.Empty;
            var    doc          = new SueetieSearchDoc()
            {
                App               = "Blogs",
                AppID             = post.ApplicationID,
                ContainerName     = post.BlogTitle,
                GroupID           = post.GroupID,
                GroupKey          = string.IsNullOrEmpty(post.GroupKey) ? "na" : post.GroupKey,
                IsRestricted      = post.IsRestricted,
                ContentID         = post.ContentID,
                PublishDate       = post.DateCreated,
                Tags              = _tags,
                DisplayTags       = _displayTags,
                Categories        = _categories,
                Title             = post.Title,
                ContentTypeID     = post.ContentTypeID,
                ApplicationTypeID = post.ApplicationTypeID,
                Author            = post.DisplayName,
                PermaLink         = post.Permalink,
                ApplicationKey    = post.ApplicationKey,
                Username          = post.Author,
                Body              = DataHelper.CleanSearchBodyContent(post.PostContent) + RaquoIt(post.BlogTitle) + RaquoIt(post.Author) + RaquoIt(post.Title) + RaquoIt(_tags) + RaquoIt(_categories)
            };

            return(doc);
        }
Example #7
0
        private int AddSueetieSearchDocs(List <SueetieSearchDoc> sueetieSearchDocs)
        {
            int _docsIndexed = 0;

            foreach (SueetieSearchDoc sueetieSearchDoc in sueetieSearchDocs)
            {
                ExecuteRemoveDoc(sueetieSearchDoc.ContentID);
                try
                {
                    SueetieSearchDoc currentSueetieSearchDoc = sueetieSearchDoc;
                    DoWriterAction(writer => writer.AddDocument(CreateLuceneDocument(currentSueetieSearchDoc)));
                    _docsIndexed++;
                }
                catch (Exception ex)
                {
                    SueetieLogs.LogSearchException(sueetieSearchDoc.ContentID, sueetieSearchDoc.Title, ex.Message + "\n\nSTACKTRACE: " + ex.StackTrace);
                }
            }
            return(_docsIndexed);
        }
Example #8
0
        protected virtual Document CreateLuceneDocument(SueetieSearchDoc sueetieSearchDoc)
        {
            Document doc = new Document();

            Field contentID = new Field(ContentID,
                                        NumericUtils.IntToPrefixCoded(sueetieSearchDoc.ContentID),
                                        Field.Store.YES,
                                        Field.Index.NOT_ANALYZED,
                                        Field.TermVector.NO);

            Field title = new Field(Title,
                                    sueetieSearchDoc.Title,
                                    Field.Store.YES,
                                    Field.Index.ANALYZED,
                                    Field.TermVector.YES);

            title.SetBoost(_config.SearchSettings.TitleBoost);

            Field body = new Field(Body,
                                   sueetieSearchDoc.Body,
                                   Field.Store.YES,
                                   Field.Index.ANALYZED,
                                   Field.TermVector.YES);

            body.SetBoost(_config.SearchSettings.BodyBoost);

            Field tags = new Field(Tags,
                                   sueetieSearchDoc.Tags,
                                   Field.Store.NO,
                                   Field.Index.ANALYZED,
                                   Field.TermVector.YES);

            tags.SetBoost(_config.SearchSettings.TagsBoost);

            Field displaytags = new Field(DisplayTags,
                                          sueetieSearchDoc.DisplayTags,
                                          Field.Store.YES,
                                          Field.Index.NOT_ANALYZED,
                                          Field.TermVector.NO);

            Field categories = new Field(Categories,
                                         sueetieSearchDoc.Categories,
                                         Field.Store.NO,
                                         Field.Index.ANALYZED,
                                         Field.TermVector.YES);

            categories.SetBoost(_config.SearchSettings.CategoryBoost);

            Field appID = new Field(AppID,
                                    NumericUtils.IntToPrefixCoded(sueetieSearchDoc.AppID),
                                    Field.Store.YES,
                                    Field.Index.NOT_ANALYZED,
                                    Field.TermVector.NO);

            Field isRestricted = new Field(IsRestricted,
                                           sueetieSearchDoc.IsRestricted.ToString(),
                                           Field.Store.NO,
                                           Field.Index.NOT_ANALYZED,
                                           Field.TermVector.NO);

            Field pubDate = new Field(Pubdate,
                                      DateTools.DateToString(sueetieSearchDoc.PublishDate, DateTools.Resolution.MINUTE),
                                      Field.Store.YES,
                                      Field.Index.NOT_ANALYZED,
                                      Field.TermVector.NO);

            Field groupID = new Field(GroupID,
                                      NumericUtils.IntToPrefixCoded(sueetieSearchDoc.GroupID),
                                      Field.Store.NO,
                                      Field.Index.NOT_ANALYZED,
                                      Field.TermVector.NO);

            Field containerName = new Field(ContainerName,
                                            sueetieSearchDoc.ContainerName,
                                            Field.Store.YES,
                                            Field.Index.NO,
                                            Field.TermVector.NO);

            Field contentTypeID = new Field(ContentTypeID,
                                            NumericUtils.IntToPrefixCoded(sueetieSearchDoc.ContentTypeID),
                                            Field.Store.YES,
                                            Field.Index.NOT_ANALYZED,
                                            Field.TermVector.NO);

            Field appTypeID = new Field(ApplicationTypeID,
                                        NumericUtils.IntToPrefixCoded(sueetieSearchDoc.ApplicationTypeID),
                                        Field.Store.YES,
                                        Field.Index.NOT_ANALYZED,
                                        Field.TermVector.NO);

            //(sueetieSearchDoc.ApplicationTypeID + 10000).ToString(),
            //Field.Store.YES,
            //Field.Index.NOT_ANALYZED,
            //Field.TermVector.NO);

            Field applicationKey = new Field(ApplicationKey,
                                             sueetieSearchDoc.ApplicationKey,
                                             Field.Store.YES,
                                             Field.Index.NO,
                                             Field.TermVector.NO);

            Field permalink = new Field(PermaLink,
                                        sueetieSearchDoc.PermaLink,
                                        Field.Store.YES,
                                        Field.Index.NO,
                                        Field.TermVector.NO);

            Field author = new Field(Author,
                                     sueetieSearchDoc.Author,
                                     Field.Store.YES,
                                     Field.Index.NO,
                                     Field.TermVector.NO);

            Field username = new Field(Username,
                                       sueetieSearchDoc.Username,
                                       Field.Store.NO,
                                       Field.Index.ANALYZED,
                                       Field.TermVector.NO);

            username.SetBoost(_config.SearchSettings.UsernameBoost);

            Field app = new Field(App,
                                  sueetieSearchDoc.App,
                                  Field.Store.NO,
                                  Field.Index.ANALYZED,
                                  Field.TermVector.NO);

            Field groupKey = new Field(GroupKey,
                                       sueetieSearchDoc.GroupKey,
                                       Field.Store.NO,
                                       Field.Index.NOT_ANALYZED,
                                       Field.TermVector.NO);

            doc.Add(contentID);
            doc.Add(title);
            doc.Add(body);
            doc.Add(tags);
            doc.Add(displaytags);
            doc.Add(categories);
            doc.Add(appID);
            doc.Add(isRestricted);
            doc.Add(pubDate);
            doc.Add(groupID);
            doc.Add(containerName);
            doc.Add(contentTypeID);
            doc.Add(applicationKey);
            doc.Add(groupKey);
            doc.Add(permalink);
            doc.Add(author);
            doc.Add(username);
            doc.Add(appTypeID);
            doc.Add(app);

            return(doc);
        }