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 DataModel.Search.IndexSchema ParseIndexSchema(PB.IndexSchema indexSchema) { var ret = new DataModel.Search.IndexSchema(); ret.IndexSetting = ParseIndexSetting(indexSchema.IndexSetting); ret.FieldSchemas = new List <DataModel.Search.FieldSchema>(); foreach (var item in indexSchema.FieldSchemasList) { ret.FieldSchemas.Add(ParseFieldSchema(item)); } return(ret); }