public static SearchSchema AddFields(this SearchSchema schema, IEnumerable <Field> fields)
 {
     foreach (var field in fields)
     {
         schema.Fields[field.Name] = field.ToSearchField();
     }
     return(schema);
 }
        static SearchDialogIndexClient()
        {
            var indexName = SettingsUtils.GetAppSettings("SearchDialogsIndexName");
            var adminKey  = SettingsUtils.GetAppSettings("SearchDialogsServiceAdminKey");

            if (adminKey != null)
            {
                var adminClient = new SearchServiceClient(SettingsUtils.GetAppSettings("SearchDialogsServiceName"),
                                                          new SearchCredentials(adminKey));
                schema = new SearchSchema().AddFields(adminClient.Indexes.Get(indexName).Fields);
            }
            var client = new SearchServiceClient(SettingsUtils.GetAppSettings("SearchDialogsServiceName"),
                                                 new SearchCredentials(SettingsUtils.GetAppSettings("SearchDialogsServiceKey")));

            searchClient = client.Indexes.GetClient(indexName);
        }