/// <summary> /// Ensures that the'_searchEmail' is added to the user fields so that it is indexed - without having to modify the config /// </summary> /// <param name="indexSet"></param> /// <returns></returns> protected override IIndexCriteria GetIndexerData(IndexSet indexSet) { var indexerData = base.GetIndexerData(indexSet); if (CanInitialize()) { //If the fields are missing a custom _searchEmail, then add it if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false) { var field = new IndexField { Name = "_searchEmail" }; StaticField policy; if (IndexFieldPolicies.TryGetValue("_searchEmail", out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; } return(new IndexCriteria( indexerData.StandardFields, indexerData.UserFields.Concat(new[] { field }), indexerData.IncludeNodeTypes, indexerData.ExcludeNodeTypes, indexerData.ParentNodeId )); } } return(indexerData); }
/// <summary> /// Ensures that the'_searchEmail' is added to the user fields so that it is indexed - without having to modify the config /// </summary> /// <param name="indexSet"></param> /// <returns></returns> protected override IIndexCriteria GetIndexerData(IndexSet indexSet) { if (CanInitialize()) { //Add a custom _searchEmail to the index criteria no matter what is in config var field = new IndexField { Name = "_searchEmail" }; StaticField policy; if (IndexFieldPolicies.TryGetValue("_searchEmail", out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; } return(indexSet.ToIndexCriteria(DataService, IndexFieldPolicies, //add additional explicit fields new [] { field })); } else { return(base.GetIndexerData(indexSet)); } }