public ResultFacet Start() { var builder = new FacetBuilder <ResultFacet, FacetDataModel, Filter, FacetWithIdName>(); builder.AddRule() .FilterBy(x => x.EmployeeId) .FilterWhat(x => x.Employee.Id) .To(x => x.EmployeeId) .As(x => new FacetWithIdName { Id = x.Employee.Id, Name = x.Employee.Name }) .AsFilter(x => x.Id != null); builder.AddRule() .FilterBy(x => x.CompanyName) .FilterWhat(x => x.Company.Name) .To(x => x.CompanyName) .As(x => new FacetWithIdName { Id = x.Company.Name, Name = x.Company.Name }) .AsFilter(x => x.Id != null); builder.AddRule() .FilterBy(x => x.City) .FilterWhat(x => x.Company.City) .To(x => x.City) .As(x => new FacetWithIdName { Id = x.Company.City, Name = x.Company.City }) .AsFilter(x => x.Id != null); return(builder.Compile(GetData(), GetFilter())); }
public IAggregationDocumentQuery <T> AggregateBy(Action <IFacetBuilder <T> > builder) { var ff = new FacetBuilder <T>(); builder.Invoke(ff); return(AggregateBy(ff.Facet)); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="searchCriteria"></param> /// <returns></returns> public SearchModel UpdateFacets(SearchCriteria searchCriteria) { MetadataReader.ListOfMetadata = MetadataReader.GetAllMetadataDatasetsWithListOfSearchCriteria(MetadataReader.ListOfMetadata, searchCriteria); //facets this.WorkingSearchModel.SearchComponent.Facets = FacetBuilder.GetAllNodesAsListFromData(FacetBuilder.CATEGORY_TYPE, MetadataReader.ListOfMetadata); return(this.WorkingSearchModel); }
public void FacetBuilder_ForAddingByNullFacetOn_ShouldThrowException() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On((FacetOn)null); // Assert }
public void FacetBuilder_ForAddingByExpression_ShouldAddByIndexField() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On(result => result.Content); // Assert Assert.IsTrue(options.Facets.Any(f => f.Key == "_content")); }
public void FacetBuilder_ForAddingByEmptyString_ShouldNotAdd() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On(String.Empty); // Assert Assert.IsTrue(options.Facets.Count == 0); }
public void FacetBuilder_ForAddingByString_ShouldAddByString() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On("_content"); // Assert Assert.IsTrue(options.Facets.Any(f => f.Key == "_content")); }
public CloudSearch(ICloudSearchSettings cloudSearchSettings) { _cloudSearchSettings = cloudSearchSettings; _searchUri = string.Format("http://search-{0}/{1}/search", _cloudSearchSettings.CloudSearchId, _cloudSearchSettings.ApiVersion); _documentUri = string.Format("http://doc-{0}/{1}/documents/batch", _cloudSearchSettings.CloudSearchId, _cloudSearchSettings.ApiVersion); _queryBuilder = new QueryBuilder <TDocument>(_searchUri); _actionBuilder = new ActionBuilder <TDocument>(); _webHelper = new WebHelper(); _hitFeeder = new HitFeeder <TDocument>(); _facetBuilder = new FacetBuilder(); PersistanteCondition = new List <IBooleanCondition>(); }
public void FacetBuilder_ForAddingByListOfExpressionsWithNull_ShouldThrowException() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On(result => result.Content, result => null, // Throw Exception result => result.TestingFacetKey); // Assert }
public void FacetBuilder_ForAddingByListOfExpressions_ShouldAddByIndexField() { // Arrange var options = new FacetOptions(); var facetBuilder = new FacetBuilder <TestSearchResultItem>(options); // Act facetBuilder.On(result => result.Content, result => result.TemplateName, result => result.TestingFacetKey); // Assert Assert.IsTrue(options.Facets.Any(f => f.Key == "_content")); Assert.IsTrue(options.Facets.Any(f => f.Key == "_templatename")); Assert.IsTrue(options.Facets.Any(f => f.Key == "testingfacetkey")); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param>NA</param> /// <returns></returns> public SearchModel initWorking() { SearchModel model = new SearchModel(); MetadataReader.ListOfMetadata = MetadataReader.GetAllMetadataDatasets(); //facets model.SearchComponent.Facets = FacetBuilder.GetAllNodesAsListFromData(FacetBuilder.CATEGORY_TYPE, MetadataReader.ListOfMetadata); //properties PropertyBuilder propertyBuilder = new PropertyBuilder(MetadataReader.ListOfMetadata); model.SearchComponent.Properties = propertyBuilder.AllProperties; //categories model.SearchComponent.Categories = CategoryBuilder.GetAllRootNodesAsList(CategoryBuilder.DROPDOWN_TYPE); //Textvalues model.SearchComponent.TextBoxSearchValues = new List <TextValue>(); return(model); }