public void MappedPropertyForWhichDynamicFieldExistsInSchemaShouldNotReturnError() { var mgr = new MappingManager(); mgr.Add(typeof(SchemaMappingTestDocument).GetProperty("ID"), "id"); mgr.SetUniqueKey(typeof(SchemaMappingTestDocument).GetProperty("ID")); mgr.Add(typeof(SchemaMappingTestDocument).GetProperty("Name"), "name"); mgr.Add(typeof(SchemaMappingTestDocument).GetProperty("Producer"), "producer_s"); var schemaManager = new MappingValidator(mgr, new[] { new MappedPropertiesIsInSolrSchemaRule() }); var schemaXmlDocument = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.solrSchemaBasic.xml"); var solrSchemaParser = new SolrSchemaParser(); var schema = solrSchemaParser.Parse(schemaXmlDocument); var validationResults = schemaManager.EnumerateValidationResults(typeof(SchemaMappingTestDocument), schema).ToList(); Assert.Equal(0, validationResults.Count); }
public DefaultSolrLocator() { MappingManager = new MemoizingMappingManager(new AttributesMappingManager()); FieldParser = new DefaultFieldParser(); DocumentPropertyVisitor = new DefaultDocumentVisitor(MappingManager, FieldParser); if (typeof(T) == typeof(Dictionary <string, object>)) { DocumentResponseParser = (ISolrDocumentResponseParser <T>) new SolrDictionaryDocumentResponseParser(FieldParser); } else { DocumentResponseParser = new SolrDocumentResponseParser <T>(MappingManager, DocumentPropertyVisitor, new SolrDocumentActivator <T>()); } ResponseParser = new DefaultResponseParser <T>(DocumentResponseParser); SchemaParser = new SolrSchemaParser(); HeaderParser = new HeaderResponseParser <string>(); DihStatusParser = new SolrDIHStatusParser(); ExtractResponseParser = new ExtractResponseParser(HeaderParser); FieldSerializer = new DefaultFieldSerializer(); QuerySerializer = new DefaultQuerySerializer(FieldSerializer); FacetQuerySerializer = new DefaultFacetQuerySerializer(QuerySerializer, FieldSerializer); MlthResultParser = new SolrMoreLikeThisHandlerQueryResultsParser <T>(new[] { ResponseParser }); StatusResponseParser = new SolrStatusResponseParser(); if (typeof(T) == typeof(Dictionary <string, object>)) { DocumentSerializer = (ISolrDocumentSerializer <T>) new SolrDictionarySerializer(FieldSerializer); } else { DocumentSerializer = new SolrDocumentSerializer <T>(MappingManager, FieldSerializer); } HttpCache = new NullCache(); }