public void DefaultFieldParameter001() { // Arrange var expected = JObject.Parse(@" { ""params"": { ""df"": ""id"" } }"); var container = new JObject(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (IDefaultFieldParameter <TestDocument>) new DefaultFieldParameter <TestDocument>(expressionBuilder); parameter.FieldExpression = q => q.Id; // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expected.ToString(), container.ToString()); }
public void FacetFieldParameterTheory001(Action <IFacetFieldParameter <TestDocument> > config, JObject expectd) { // Arrange var container = new JObject(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var serviceProvider = new Mock <ISolrExpressServiceProvider <TestDocument> >(); serviceProvider .Setup(q => q.GetService <IFacetFieldParameter <TestDocument> >()) .Returns(new FacetFieldParameter <TestDocument>(expressionBuilder, serviceProvider.Object)); serviceProvider .Setup(q => q.GetService <SearchQuery <TestDocument> >()) .Returns(new SearchQuery <TestDocument>(expressionBuilder)); var parameter = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, serviceProvider.Object); config.Invoke(parameter); // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expectd.ToString(), container.ToString()); }
public void LocalParameter001() { // Arrange var expected = JObject.Parse(@" { ""params"": { ""myLocalParameter"": ""id:\""ITEM01\"""" } }"); var container = new JObject(); var parameter = new LocalParameter <TestDocument>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); parameter.Name = "myLocalParameter"; parameter.Query = searchQuery.Field(q => q.Id).EqualsTo("ITEM01"); // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expected.ToString(), container.ToString()); }
public void FieldsParameter001() { // Arrange var expected = JObject.Parse(@" { ""fields"": [ ""id"", ""score"" ] }"); var container = new JObject(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (IFieldsParameter <TestDocument>) new FieldsParameter <TestDocument>(expressionBuilder); parameter.FieldExpressions = new Expression <Func <TestDocument, object> >[] { q => q.Id, q => q.Score }; // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expected.ToString(), container.ToString()); }
public void FilterQueryParameter002() { // Arrange var expected = JObject.Parse(@" { ""filter"": [ ""{!tag=tag1}id:\""X\"""" ] }"); var container = new JObject(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); var parameter = (IFilterParameter <TestDocument>) new FilterParameter <TestDocument>(); parameter.Query = searchQuery.Field(q => q.Id).AddValue("X"); parameter.TagName = "tag1"; // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expected.ToString(), container.ToString()); }
public void BaseStandardQueryParameter002() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter1 = new Mock <BaseStandardQueryParameter <TestDocument> > { CallBase = true }.Object; parameter1.Value = new SearchQuery <TestDocument>(expressionBuilder).AddField(q => q.Id); var parameter2 = new Mock <BaseStandardQueryParameter <TestDocument> > { CallBase = true }.Object; parameter2.Value = new SearchQuery <TestDocument>(expressionBuilder).AddField(q => q.Dummy); // Act var result = parameter1.Equals(parameter2); // Assert Assert.False(result); }
public void BaseDefaultFieldParameter002() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter1 = new Mock <BaseDefaultFieldParameter <TestDocument> > { CallBase = true }.Object; parameter1.ExpressionBuilder = expressionBuilder; parameter1.FieldExpression = q => q.Id; var parameter2 = new Mock <BaseDefaultFieldParameter <TestDocument> > { CallBase = true }.Object; parameter2.ExpressionBuilder = expressionBuilder; parameter2.FieldExpression = q => q.Dummy; // Act var result = parameter1.Equals(parameter2); // Assert Assert.False(result); }
public void BaseBoostParameter002() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); var parameter1 = new Mock <BaseBoostParameter <TestDocument> > { CallBase = true }.Object; parameter1.BoostFunctionType = BoostFunctionType.Bf; parameter1.Query = searchQuery.Field(q => q.Id); var parameter2 = new Mock <BaseBoostParameter <TestDocument> > { CallBase = true }.Object; parameter2.BoostFunctionType = BoostFunctionType.Boost; parameter2.Query = searchQuery.Field(q => q.Id); // Act var result = parameter1.Equals(parameter2); // Assert Assert.False(result); }
public void Setup() { var solrExpressOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrExpressOptions, solrConnection); expressionBuilder.LoadDocument(); var facetRange1 = (IFacetRangeParameter <TestDocument>) new FacetRangeParameter <TestDocument>(expressionBuilder, null); facetRange1.FieldExpression = field => field.Age; facetRange1.AliasName = "facetRange"; this._searchParameters = new List <ISearchParameter> { facetRange1 }; this._result = new FacetsResult <TestDocument>(); // Data using http://www.json-generator.com/ var assembly = typeof(FacetsResultBenchmarks).GetTypeInfo().Assembly; var jsonPlainText = EmbeddedResourceHelper.GetByName(assembly, $"SolrExpress.Benchmarks.Solr4.Search.Result.FacetsResultBenchmarks_{this.FacetTypes}{this.ElementsCount}.json"); this._jsonStream = new MemoryStream(Encoding.GetEncoding(0).GetBytes(jsonPlainText)); }
public void FilterQueryParameter001() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter1 = (IFilterParameter <TestDocument>) new FilterParameter <TestDocument>(); parameter1.Query = new SearchQuery <TestDocument>(expressionBuilder).Field(q => q.Id).AddValue("X"); var parameter2 = (IFilterParameter <TestDocument>) new FilterParameter <TestDocument>(); parameter2.Query = new SearchQuery <TestDocument>(expressionBuilder).Field(q => q.Score).AddValue("Y"); // Act ((ISearchItemExecution <List <string> >)parameter1).Execute(); ((ISearchItemExecution <List <string> >)parameter1).AddResultInContainer(container); ((ISearchItemExecution <List <string> >)parameter2).Execute(); ((ISearchItemExecution <List <string> >)parameter2).AddResultInContainer(container); // Assert Assert.Equal(2, container.Count); Assert.Equal("fq=id:\"X\"", container[0]); Assert.Equal("fq=score:\"Y\"", container[1]); }
public void BaseFieldsParameter001() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter1 = new Mock <BaseFieldsParameter <TestDocument> > { CallBase = true }.Object; parameter1.ExpressionBuilder = expressionBuilder; parameter1.FieldExpressions = new Expression <Func <TestDocument, object> >[] { q => q.Id, q => q.Score }; // Act var result = parameter1.Equals(parameter1); // Assert Assert.True(result); }
public void SearchQueryFact006() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TechProductDocument>(); var expressionBuilder = new ExpressionBuilder <TechProductDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TechProductDocument>(expressionBuilder); // Act var result = searchQuery.AddValue(new DateTime(1984, 09, 05, 10, 20, 30)).Execute(); // Assert Assert.Equal("1984-09-05T10:20:30Z", result); }
public void SearchQueryFact004() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TechProductDocument>(); var expressionBuilder = new ExpressionBuilder <TechProductDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TechProductDocument>(expressionBuilder); // Act var result = searchQuery.EqualsTo(10).Execute(); // Assert Assert.Equal("10", result); }
public void SearchQueryFact009() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TechProductDocument>(); var expressionBuilder = new ExpressionBuilder <TechProductDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TechProductDocument>(expressionBuilder); // Act var result = searchQuery.Contains("some value").Execute(); // Assert Assert.Equal(@"/*.some value.*/", result); }
public void SearchQueryFact006() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); // Act var result = searchQuery.Field(q => q.Id).Execute(); // Assert Assert.Equal("id", result); }
public void SearchQueryFact010() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TechProductDocument>(); var expressionBuilder = new ExpressionBuilder <TechProductDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TechProductDocument>(expressionBuilder); // Act var result = searchQuery .Field(f => f.Id).EqualsTo(10) .Or(q => q.Field(f => f.Name).Any("name#1", "name#2", "name#3")) .Execute(); // Assert Assert.Equal("id:10 OR (name:(\"name#1\" OR \"name#2\" OR \"name#3\"))", result); }
public void FacetRangeParameterTheory002(Action <IFacetRangeParameter <TestDocument> > config) { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var serviceProvider = new Mock <ISolrExpressServiceProvider <TestDocument> >(); serviceProvider .Setup(q => q.GetService <SearchQuery <TestDocument> >()) .Returns(new SearchQuery <TestDocument>(expressionBuilder)); var parameter = (IFacetRangeParameter <TestDocument>) new FacetRangeParameter <TestDocument>(expressionBuilder, serviceProvider.Object); config.Invoke(parameter); // Act / Assert Assert.Throws <UnsupportedFeatureException>(() => ((ISearchItemExecution <List <string> >)parameter).Execute()); }
public void SpatialFilterParameterTheory001(Action <ISpatialFilterParameter <TestDocument> > config, JObject expectd) { // Arrange var container = new JObject(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (ISpatialFilterParameter <TestDocument>) new SpatialFilterParameter <TestDocument>(expressionBuilder); config.Invoke(parameter); // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expectd.ToString(), container.ToString()); }
public void SortParameter001() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (ISortParameter <TestDocument>) new SortParameter <TestDocument>(expressionBuilder); parameter.FieldExpression(q => q.Id); // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("sort=id asc", container[0]); }
public void StandardQueryParameter001() { // Arrange var expected = JObject.Parse("{\"params\":{\"q.alt\": \"id:\\\"ITEM01\\\"\"}}"); var container = new JObject(); var parameter = (IStandardQueryParameter <TestDocument>) new StandardQueryParameter <TestDocument>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); parameter.Value = searchQuery.Field(q => q.Id).EqualsTo("ITEM01"); // Act ((ISearchItemExecution <JObject>)parameter).Execute(); ((ISearchItemExecution <JObject>)parameter).AddResultInContainer(container); // Assert Assert.Equal(expected.ToString(), container.ToString()); }
public void DefaultFieldParameter001() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = new DefaultFieldParameter <TestDocument>(expressionBuilder) { FieldExpression = q => q.Id }; // Act parameter.Execute(); parameter.AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("df=id", container[0]); }
public void QueryParameter002() { // Arrange var container = new List <string>(); var parameter = (IQueryParameter <TestDocument>) new QueryParameter <TestDocument>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); parameter.Value = searchQuery.EqualsTo("ITEM01"); // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("q=\"ITEM01\"", container[0]); }
public void FacetRangeParameterTheory001(Action <IFacetRangeParameter <TestDocument> > config, string expectd) { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (IFacetRangeParameter <TestDocument>) new FacetRangeParameter <TestDocument>(expressionBuilder, null); config.Invoke(parameter); // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert var actual = string.Join("&", container); Assert.Equal(expectd, actual); }
public void LocalParameter001() { // Arrange var container = new List <string>(); var parameter = new LocalParameter <TestDocument>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); parameter.Name = "myLocalParameter"; parameter.Query = searchQuery.Field(q => q.Id).EqualsTo("ITEM01"); // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("myLocalParameter=id:\"ITEM01\"", container[0]); }
public void FilterQueryParameter002() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); var parameter = (IFilterParameter <TestDocument>) new FilterParameter <TestDocument>(); parameter.Query = searchQuery.Field(q => q.Id).AddValue("X"); parameter.TagName = "tag1"; // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("fq={!tag=tag1}id:\"X\"", container[0]); }
public void BoostParameterTheory001(BoostFunctionType boostFunctionType, string expected) { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TestDocument>(expressionBuilder); var parameter = (IBoostParameter <TestDocument>) new BoostParameter <TestDocument>(); parameter.BoostFunctionType = boostFunctionType; parameter.Query = searchQuery.Field(q => q.Id); // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal(expected, container[0]); }
public void SearchQueryFact011() { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TechProductDocument>(); var expressionBuilder = new ExpressionBuilder <TechProductDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var searchQuery = new SearchQuery <TechProductDocument>(expressionBuilder); // Act var result = searchQuery .Group(g => g .Field(f => f.Id).EqualsTo(10) .And(q => q.Field(f => f.Popularity).InRange(10, 20)) ) .Or(q => q.Field(f => f.Name).Any("name#1", "name#2", "name#3")) .Execute(); // Assert Assert.Equal("(id:10 AND (popularity:[10 TO 20])) OR (name:(\"name#1\" OR \"name#2\" OR \"name#3\"))", result); }
public void FieldsParameter001() { // Arrange var container = new List <string>(); var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = (IFieldsParameter <TestDocument>) new FieldsParameter <TestDocument>(expressionBuilder); parameter.FieldExpressions = new Expression <Func <TestDocument, object> >[] { q => q.Id, q => q.Score }; // Act ((ISearchItemExecution <List <string> >)parameter).Execute(); ((ISearchItemExecution <List <string> >)parameter).AddResultInContainer(container); // Assert Assert.Single(container); Assert.Equal("fl=id,score", container[0]); }
public void FacetRangeTypeAttributeTheory(Expression <Func <TestDocumentFieldAllowToFacet, object> > fieldExpression) { // Arrange var solrOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocumentFieldAllowToFacet>(); var expressionBuilder = new ExpressionBuilder <TestDocumentFieldAllowToFacet>(solrOptions, solrConnection); expressionBuilder.LoadDocument(); var parameter = new FakeFacetRangeParameter <TestDocumentFieldAllowToFacet> { ExpressionBuilder = expressionBuilder }; parameter.AliasName("."); parameter.FieldExpression(fieldExpression); var validator = new FacetRangeTypeAttribute(); // Act var result = validator.IsValid <TestDocumentFieldAllowToFacet>(parameter, out var errorMessage); // Assert Assert.True(result); }
public void Setup() { var solrExpressOptions = new SolrExpressOptions(); var solrConnection = new FakeSolrConnection <TestDocument>(); var expressionBuilder = new ExpressionBuilder <TestDocument>(solrExpressOptions, solrConnection); expressionBuilder.LoadDocument(); var facetField1 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField1.FieldExpression = field => field.About; var facetField2 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField2.FieldExpression = field => field.Address; var facetField3 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField3.FieldExpression = field => field.Age; var facetField4 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField4.FieldExpression = field => field.Balance; var facetField5 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField5.FieldExpression = field => field.Company; var facetField6 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField6.FieldExpression = field => field.Email; var facetField7 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField7.FieldExpression = field => field.EyeColor; var facetField8 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField8.FieldExpression = field => field.FavoriteFruit; var facetField9 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField9.FieldExpression = field => field.Gender; var facetField10 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField10.FieldExpression = field => field.Greeting; var facetField11 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField11.FieldExpression = field => field.IsActive; var facetField12 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField12.FieldExpression = field => field.Latitude; var facetField13 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField13.FieldExpression = field => field.Longitude; var facetField14 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField14.FieldExpression = field => field.Name; var facetField15 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField15.FieldExpression = field => field.Phone; var facetField16 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField16.FieldExpression = field => field.Registered; var facetField17 = (IFacetFieldParameter <TestDocument>) new FacetFieldParameter <TestDocument>(expressionBuilder, null); facetField17.FieldExpression = field => field.Score; var facetRange1 = (IFacetRangeParameter <TestDocument>) new FacetRangeParameter <TestDocument>(expressionBuilder, null); facetRange1.FieldExpression = field => field.Age; facetRange1.AliasName = "facetRange"; this._searchParameters = new List <ISearchParameter> { facetField1, facetField2, facetField3, facetField4, facetField5, facetField6, facetField7, facetField8, facetField9, facetField10, facetField11, facetField12, facetField13, facetField14, facetField15, facetField16, facetField17, facetRange1 }; for (var i = 0; i < this.ElementsCount; i++) { var facetQuery = (IFacetQueryParameter <TestDocument>) new FacetQueryParameter <TestDocument>(null); facetQuery.AliasName = $"VaLUE{i}"; _searchParameters.Add(facetQuery); } this._result = new FacetsResult <TestDocument>(); // Data using http://www.json-generator.com/ var assembly = typeof(FacetsResultBenchmarks).GetTypeInfo().Assembly; var jsonPlainText = EmbeddedResourceHelper.GetByName(assembly, $"SolrExpress.Benchmarks.Solr5.Search.Result.FacetsResultBenchmarks_{this.FacetTypes}{this.ElementsCount}.json"); this._jsonStream = new MemoryStream(Encoding.GetEncoding(0).GetBytes(jsonPlainText)); }