Пример #1
0
 public static void Create(SiteSettings ss, SiteModel siteModel)
 {
     if (Parameters.Search.Provider.IsNullOrEmpty() && Parameters.Search.CreateIndexes)
     {
         Task.Run(() => CreateIndexes(
                      ss,
                      siteModel.SearchIndexHash(ss),
                      siteModel.SiteId));
     }
 }
Пример #2
0
 public static void Create(SiteSettings ss, SiteModel siteModel)
 {
     if (Parameters.Service.CreateIndexes)
     {
         Task.Run(() => CreateIndexes(
                      ss,
                      siteModel.SearchIndexHash(ss),
                      siteModel.SiteId));
     }
 }
Пример #3
0
 public static void Create(IContext context, SiteSettings ss, SiteModel siteModel)
 {
     if (Parameters.Search.Provider.IsNullOrEmpty() && Parameters.Search.CreateIndexes)
     {
         Task.Run(() => CreateIndexes(
                      context: context,
                      ss: ss,
                      hash: siteModel.SearchIndexHash(
                          context: context,
                          ss: ss),
                      id: siteModel.SiteId));
     }
 }
Пример #4
0
        public static void Create(IContext context, SiteSettings ss, long id, bool force = false)
        {
            if (Parameters.Search.Provider.IsNullOrEmpty() && Parameters.Search.CreateIndexes)
            {
                var itemModel = new ItemModel(
                    context: context,
                    referenceId: id);
                switch (itemModel.ReferenceType)
                {
                case "Sites":
                    var siteModel = new SiteModel(context: context, siteId: id);
                    Task.Run(() => CreateIndexes(
                                 context: context,
                                 ss: ss,
                                 hash: siteModel.SearchIndexHash(context: context, ss: ss),
                                 id: id));
                    break;

                case "Issues":
                    var issueModel = new IssueModel(context: context, ss: ss, issueId: id);
                    Task.Run(() => CreateIndexes(
                                 context: context,
                                 ss: ss,
                                 hash: issueModel.SearchIndexHash(context: context, ss: ss),
                                 id: id));
                    break;

                case "Results":
                    var resultModel = new ResultModel(context: context, ss: ss, resultId: id);
                    Task.Run(() => CreateIndexes(
                                 context: context,
                                 ss: ss,
                                 hash: resultModel.SearchIndexHash(context: context, ss: ss),
                                 id: id));
                    break;

                case "Wikis":
                    var wikiModel = new WikiModel(context: context, ss: ss, wikiId: id);
                    Task.Run(() => CreateIndexes(
                                 context: context,
                                 ss: ss,
                                 hash: wikiModel.SearchIndexHash(context: context, ss: ss),
                                 id: id));
                    break;
                }
            }
            else if (force)
            {
                var itemModel = new ItemModel(
                    context: context,
                    referenceId: id);
                switch (itemModel.ReferenceType)
                {
                case "Sites":
                    var siteModel = new SiteModel(context: context, siteId: id);
                    switch (Parameters.Search.Provider)
                    {
                    case "FullText":
                        CreateFullText(
                            context: context,
                            id: id,
                            fullText: siteModel.FullText(
                                context: context,
                                ss: ss,
                                backgroundTask: true));
                        break;

                    default:
                        CreateIndexes(
                            context: context,
                            ss: ss,
                            hash: siteModel.SearchIndexHash(context: context, ss: ss),
                            id: id);
                        break;
                    }
                    break;

                case "Issues":
                    var issueModel = new IssueModel(
                        context: context,
                        ss: ss,
                        issueId: id);
                    ss.Links?
                    .Where(o => ss.GetColumn(
                               context: context,
                               columnName: o.ColumnName).UseSearch == true)
                    .ForEach(link =>
                             ss.SetChoiceHash(
                                 context: context,
                                 columnName: link.ColumnName,
                                 selectedValues: new List <string>
                    {
                        issueModel.PropertyValue(
                            context: context, name: link.ColumnName)
                    }));
                    switch (Parameters.Search.Provider)
                    {
                    case "FullText":
                        CreateFullText(
                            context: context,
                            id: id,
                            fullText: issueModel.FullText(
                                context: context,
                                ss: ss,
                                backgroundTask: true));
                        break;

                    default:
                        CreateIndexes(
                            context: context,
                            ss: ss,
                            hash: issueModel.SearchIndexHash(
                                context: context,
                                ss: ss),
                            id: id);
                        break;
                    }
                    break;

                case "Results":
                    var resultModel = new ResultModel(
                        context: context,
                        ss: ss,
                        resultId: id);
                    ss.Links?
                    .Where(o => ss.GetColumn(
                               context: context,
                               columnName: o.ColumnName).UseSearch == true)
                    .ForEach(link =>
                             ss.SetChoiceHash(
                                 context: context,
                                 columnName: link.ColumnName,
                                 selectedValues: new List <string>
                    {
                        resultModel.PropertyValue(
                            context: context, name: link.ColumnName)
                    }));
                    switch (Parameters.Search.Provider)
                    {
                    case "FullText":
                        CreateFullText(
                            context: context,
                            id: id,
                            fullText: resultModel.FullText(
                                context: context,
                                ss: ss,
                                backgroundTask: true));
                        break;

                    default:
                        CreateIndexes(
                            context: context,
                            ss: ss,
                            hash: resultModel.SearchIndexHash(
                                context: context,
                                ss: ss),
                            id: id);
                        break;
                    }
                    break;

                case "Wikis":
                    var wikiModel = new WikiModel(
                        context: context,
                        ss: ss,
                        wikiId: id);
                    switch (Parameters.Search.Provider)
                    {
                    case "FullText":
                        CreateFullText(
                            context: context,
                            id: id,
                            fullText: wikiModel.FullText(
                                context: context,
                                ss: ss,
                                backgroundTask: true));
                        break;

                    default:
                        CreateIndexes(
                            context: context,
                            ss: ss,
                            hash: wikiModel.SearchIndexHash(
                                context: context,
                                ss: ss),
                            id: id);
                        break;
                    }
                    break;
                }
            }
        }
Пример #5
0
        public static void Create(SiteSettings ss, long id, bool backgroundTask = false)
        {
            if (Parameters.Service.CreateIndexes)
            {
                var itemModel = new ItemModel(id);
                switch (itemModel.ReferenceType)
                {
                case "Sites":
                    var siteModel = new SiteModel(id);
                    Task.Run(() => CreateIndexes(
                                 ss,
                                 siteModel.SearchIndexHash(ss),
                                 id));
                    break;

                case "Issues":
                    var issueModel = new IssueModel(ss, id);
                    Task.Run(() => CreateIndexes(
                                 ss,
                                 issueModel.SearchIndexHash(ss),
                                 id));
                    break;

                case "Results":
                    var resultModel = new ResultModel(ss, id);
                    Task.Run(() => CreateIndexes(
                                 ss,
                                 resultModel.SearchIndexHash(ss),
                                 id));
                    break;

                case "Wikis":
                    var wikiModel = new WikiModel(ss, id);
                    Task.Run(() => CreateIndexes(
                                 ss,
                                 wikiModel.SearchIndexHash(ss),
                                 id));
                    break;
                }
            }
            else if (backgroundTask)
            {
                var itemModel = new ItemModel(id);
                switch (itemModel.ReferenceType)
                {
                case "Sites":
                    var siteModel = new SiteModel(id);
                    CreateIndexes(
                        ss,
                        siteModel.SearchIndexHash(ss),
                        id);
                    break;

                case "Issues":
                    var issueModel = new IssueModel(ss, id);
                    ss.Links?
                    .Where(o => ss.GetColumn(o.ColumnName).UseSearch == true)
                    .ForEach(link =>
                             ss.SetChoiceHash(
                                 columnName: link.ColumnName,
                                 selectedValues: new List <string>
                    {
                        issueModel.PropertyValue(link.ColumnName)
                    }));
                    CreateIndexes(
                        ss,
                        issueModel.SearchIndexHash(ss),
                        id);
                    break;

                case "Results":
                    var resultModel = new ResultModel(ss, id);
                    ss.Links?
                    .Where(o => ss.GetColumn(o.ColumnName).UseSearch == true)
                    .ForEach(link =>
                             ss.SetChoiceHash(
                                 columnName: link.ColumnName,
                                 selectedValues: new List <string>
                    {
                        resultModel.PropertyValue(link.ColumnName)
                    }));
                    CreateIndexes(
                        ss,
                        resultModel.SearchIndexHash(ss),
                        id);
                    break;

                case "Wikis":
                    var wikiModel = new WikiModel(ss, id);
                    CreateIndexes(
                        ss,
                        wikiModel.SearchIndexHash(ss),
                        id);
                    break;
                }
            }
        }