private PB.IndexSchema EncodeIndexSchema(DataModel.Search.IndexSchema schema) { var builder = PB.IndexSchema.CreateBuilder(); if (schema.IndexSetting != null) { builder.SetIndexSetting(EncodeIndexSetting(schema.IndexSetting)); } else { builder.SetIndexSetting(EncodeIndexSetting(new DataModel.Search.IndexSetting())); } if (schema.FieldSchemas != null) { for (var i = 0; i < schema.FieldSchemas.Count; i++) { builder.FieldSchemasList.Add(EncodingFieldSchema(schema.FieldSchemas[i])); } } if (schema.IndexSort != null) { builder.SetIndexSort(SearchSortBuilder.BuildSort(schema.IndexSort)); } return(builder.Build()); }
private PB.SearchQuery EncodeSearchQuery(DataModel.Search.SearchQuery searchQuery) { var builder = PB.SearchQuery.CreateBuilder(); if (searchQuery.Limit.HasValue) { builder.SetLimit(searchQuery.Limit.Value); } if (searchQuery.Offset.HasValue) { builder.SetOffset(searchQuery.Offset.Value); } if (searchQuery.Collapse != null) { builder.SetCollapse(EncodeCollapse(searchQuery.Collapse)); } if (searchQuery.Query != null) { builder.SetQuery(SearchQueryBuilder.BuildQuery(searchQuery.Query)); } if (searchQuery.Sort != null) { builder.SetSort(SearchSortBuilder.BuildSort(searchQuery.Sort)); } builder.SetGetTotalCount(searchQuery.GetTotalCount); if (searchQuery.Token != null) { builder.SetToken(ByteString.CopyFrom(searchQuery.Token)); } return(builder.Build()); }
public SearchQuery(ISearchRequest request, ISearchPageParser pageParser) : base(request) { PredicateBuilder = new SearchPredicateBuilder <T>(pageParser, request); SortBuilder = new SearchSortBuilder <T>(request.GetSorts()); FacetBuilder = new SearchFacetBuilder <T>(request.GetRefinements()); }