Example #1
0
        public Schema BuildSchemaForSearch(SchemaHelperModel schemaModel)
        {
            var currentSchema = new Schema();

            foreach (var item in schemaModel.SearchFields)
            {
                currentSchema.AddField(item);
            }
            foreach (var item in schemaModel.TextFields)
            {
                currentSchema.AddSortableTextField(item.FIeldName, item.Weignt);
            }
            foreach (var item in schemaModel.NumericFieldName)
            {
                currentSchema.AddNumericField(item);
            }
            foreach (var item in schemaModel.TagFilterName)
            {
                currentSchema.AddTagField(item);
            }
            foreach (var item in schemaModel.GeoFilterName)
            {
                currentSchema.AddGeoField(item);
            }

            return(currentSchema);
        }
        public override bool CreateIndex()
        {
            Schema sch = new Schema();

            sch.AddTextField("Name");
            sch.AddTextField("Country");
            sch.AddTextField("Address");
            sch.AddGeoField("GeoPoint");

            return(_client.CreateIndex(sch, Client.IndexOptions.Default));
        }