Пример #1
0
        private void SetSearchWhere(Context context, SiteSettings ss, SqlWhereCollection where)
        {
            if (Search.IsNullOrEmpty())
            {
                return;
            }
            var select = SearchIndexUtilities.Select(
                context: context,
                searchType: ss.SearchType,
                searchText: Search,
                siteIdList: ss.AllowedIntegratedSites != null
                    ? ss.AllowedIntegratedSites
                    : new List <long> {
                ss.SiteId
            });

            if (select != null)
            {
                switch (ss.ReferenceType)
                {
                case "Issues":
                    where.Add(
                        tableName: ss.ReferenceType,
                        columnBrackets: "[IssueId]".ToSingleArray(),
                        name: "IssueId",
                        _operator: " in ",
                        sub: select,
                        subPrefix: false);
                    break;

                case "Results":
                    where.Add(
                        tableName: ss.ReferenceType,
                        columnBrackets: "[ResultId]".ToSingleArray(),
                        name: "ResultId",
                        _operator: " in ",
                        sub: select,
                        subPrefix: false);
                    break;

                case "Wikis":
                    where.Add(
                        tableName: ss.ReferenceType,
                        columnBrackets: "[WikiId]".ToSingleArray(),
                        name: "WikiId",
                        _operator: " in ",
                        sub: select,
                        subPrefix: false);
                    break;
                }
            }
            else
            {
                where.Add(tableName: null, raw: "0=1");
            }
        }
Пример #2
0
        public string RebuildSearchIndexes(IContext context, long id)
        {
            var log  = new SysLogModel(context: context);
            var json = SearchIndexUtilities.RebuildSearchIndexes(
                context: context,
                siteModel: new SiteModel(
                    context: context,
                    siteId: id));

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
Пример #3
0
        public static string Do(Context context)
        {
            var now = DateTime.Now;

            while ((DateTime.Now - now).Seconds <= Parameters.BackgroundTask.BackgroundTaskSpan)
            {
                SysLogUtilities.Maintain(context: context);
                SearchIndexUtilities.Maintain(context: context);
                SearchIndexUtilities.RebuildSearchIndexes(context: context);
                Thread.Sleep(Parameters.BackgroundTask.Interval);
                LatestTime = DateTime.Now;
            }
            return(new ResponseCollection().ToJson());
        }
Пример #4
0
        public static string Do()
        {
            var now = DateTime.Now;

            while ((DateTime.Now - now).Seconds <= Parameters.BackgroundTask.BackgroundTaskSpan)
            {
                SysLogUtilities.Maintain();
                SearchIndexUtilities.Maintain();
                SearchIndexUtilities.CreateInBackground();
                Thread.Sleep(Parameters.BackgroundTask.Interval);
                LatestTime = DateTime.Now;
            }
            HttpContext.Current.Session.Abandon();
            return(new ResponseCollection().ToJson());
        }
Пример #5
0
 public string Search(IContext context)
 {
     if (!context.Ajax)
     {
         var log  = new SysLogModel(context: context);
         var html = SearchIndexUtilities.Search(context: context);
         log.Finish(context: context, responseSize: html.Length);
         return(html);
     }
     else
     {
         var log  = new SysLogModel(context: context);
         var json = SearchIndexUtilities.SearchJson(context: context);
         log.Finish(context: context, responseSize: json.Length);
         return(json);
     }
 }
Пример #6
0
 public ActionResult Search()
 {
     if (!Libraries.Requests.Request.IsAjaxRequest(Request))
     {
         var log  = new SysLogModel();
         var html = SearchIndexUtilities.Search();
         ViewBag.HtmlBody = html;
         log.Finish(html.Length);
         return(View());
     }
     else
     {
         var log  = new SysLogModel();
         var json = SearchIndexUtilities.SearchJson();
         log.Finish(json.Length);
         return(Content(json));
     }
 }
Пример #7
0
        public ActionResult Search()
        {
            var context = new Context();

            if (!Request.IsAjaxRequest())
            {
                var log  = new SysLogModel(context: context);
                var html = SearchIndexUtilities.Search(context: context);
                ViewBag.HtmlBody = html;
                log.Finish(context: context, responseSize: html.Length);
                return(View());
            }
            else
            {
                var log  = new SysLogModel(context: context);
                var json = SearchIndexUtilities.SearchJson(context: context);
                log.Finish(context: context, responseSize: json.Length);
                return(Content(json));
            }
        }