public SolrFieldNameTranslator(SolrSearchIndex solrSearchIndex) { this.index = solrSearchIndex; this.fieldMap = solrSearchIndex.Configuration.FieldMap as SolrFieldMap; this.schema = solrSearchIndex.Schema as SolrIndexSchema; this.settings = solrSearchIndex.Locator.GetInstance <ISettings>(); }
private Dictionary <string, List <string> > MapDocumentFieldsToTypeIndexer(Type type, IEnumerable <string> documentFieldNames) { Dictionary <string, List <string> > dictionary = documentFieldNames.ToDictionary <string, string, List <string> >((Func <string, string>)(f => f.ToLowerInvariant()), (Func <string, List <string> >)(f => this.GetTypeFieldNames(f).ToList <string>())); foreach (PropertyInfo property in this.GetProperties(type)) { string index = property.Name; Type propertyType = property.PropertyType; IIndexFieldNameFormatterAttribute formatterAttribute = this.GetIndexFieldNameFormatterAttribute((MemberInfo)property); string fieldName = property.Name; if (formatterAttribute != null) { index = formatterAttribute.GetIndexFieldName(index); fieldName = formatterAttribute.GetTypeFieldName(fieldName); } if (!this.schema.AllFieldNames.Contains(index)) { SolrSearchFieldConfiguration fieldConfiguration = this.fieldMap.GetFieldConfiguration(propertyType) as SolrSearchFieldConfiguration; if (fieldConfiguration != null) { index = fieldConfiguration.FormatFieldName(index, (ISearchIndexSchema)this.schema, this.currentCultureCode, (string)null); } } if (dictionary.ContainsKey(index)) { dictionary[index].Add(fieldName); } } return(dictionary); }
public SolrSearchWithSpatialContext(SolrSearchIndex index, SearchSecurityOptions options = SearchSecurityOptions.EnableSecurityCheck) : base(index, options) { Assert.ArgumentNotNull((object)index, "index"); Assert.ArgumentNotNull((object)options, "options"); this.index = index; this.contentSearchSettings = this.index.Locator.GetInstance <IContentSearchConfigurationSettings>(); this.settings = this.index.Locator.GetInstance <ISettings>(); this.securityOptions = options; }
public SSSolrSearchContext(SSSolrSearchIndex index, SearchSecurityOptions options = SearchSecurityOptions.Default) { Assert.ArgumentNotNull(index, nameof(index)); Assert.ArgumentNotNull(options, nameof(options)); if (options == SearchSecurityOptions.Default) { options = index.Configuration.DefaultSearchSecurityOption; } this.index = index; contentSearchSettings = index.Locator.GetInstance <IContentSearchConfigurationSettings>(); settings = index.Locator.GetInstance <ISettings>(); securityOptions = options; var solrUrl = $"{SolrContentSearchManager.SolrSettings.ServiceAddress().TrimEnd('/')}/"; _api = new SearchContext(new System.Net.Http.HttpClient { BaseAddress = new Uri(solrUrl) }, index.Core, new SitecoreNodeTranslator(new FieldTranslator(index.FieldNameTranslator)), new ResposeTranslator(index.FieldNameTranslator)); }
private ISolrOperations <Dictionary <string, object> > GetOperations(SolrSearchIndex index) { return(indexOperationsInfo.GetValue(index) as ISolrOperations <Dictionary <string, object> >); }
public CustomSolrFieldNameTranslator(SolrSearchIndex solrSearchIndex) : base(solrSearchIndex) { this.fieldMap = solrSearchIndex.Configuration.FieldMap as SolrFieldMap; }