Skip to content

Commit ea94b10

Browse files
DOC-4733 try version check, following feedback
1 parent 7c75462 commit ea94b10

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

tests/Doc/GeoIndexExample.cs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,30 @@ public void run()
108108
// REMOVE_END
109109

110110
// STEP_START create_gshape_idx
111-
Schema geomSchema = new Schema()
112-
.AddGeoShapeField(
113-
new FieldName("$.geom", "geom"),
114-
Schema.GeoShapeField.CoordinateSystem.FLAT
115-
)
116-
.AddTextField(new FieldName("$.name", "name"));
117-
118-
bool geomCreateResult = db.FT().Create(
119-
"geomidx",
120-
new FTCreateParams()
121-
.On(IndexDataType.JSON)
122-
.Prefix("shape:"),
123-
geomSchema
124-
);
125-
Console.WriteLine(geomCreateResult); // >>> True
111+
Version version = muxer.GetServer("localhost:6379").Version;
112+
if (version.Major >= 7)
113+
{
114+
Schema geomSchema = new Schema()
115+
.AddGeoShapeField(
116+
new FieldName("$.geom", "geom"),
117+
Schema.GeoShapeField.CoordinateSystem.FLAT
118+
)
119+
.AddTextField(new FieldName("$.name", "name"));
120+
121+
bool geomCreateResult = db.FT().Create(
122+
"geomidx",
123+
new FTCreateParams()
124+
.On(IndexDataType.JSON)
125+
.Prefix("shape:"),
126+
geomSchema
127+
);
128+
// REMOVE_START
129+
Assert.True(geomCreateResult);
130+
// REMOVE_END
131+
Console.WriteLine(geomCreateResult); // >>> True
132+
}
126133
// STEP_END
127-
// REMOVE_START
128-
Assert.True(geomCreateResult);
129-
// REMOVE_END
134+
130135

131136
// STEP_START add_gshape_json
132137
var shape1 = new

0 commit comments

Comments
 (0)