@@ -178,28 +178,31 @@ public void run()
178178 // REMOVE_END
179179
180180 // STEP_START gshape_query
181- SearchResult geomQueryResult = db . FT ( ) . Search (
182- "geomidx" ,
183- new Query ( "(-@name:(Green Square) @geom:[WITHIN $qshape])" )
184- . AddParam ( "qshape" , "POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1))" )
185- . Limit ( 0 , 1 )
186- ) ;
181+ if ( version . Major >= 7 )
182+ {
183+ SearchResult geomQueryResult = db . FT ( ) . Search (
184+ "geomidx" ,
185+ new Query ( "(-@name:(Green Square) @geom:[WITHIN $qshape])" )
186+ . AddParam ( "qshape" , "POLYGON ((1 1, 1 3, 3 3, 3 1, 1 1))" )
187+ . Limit ( 0 , 1 )
188+ ) ;
187189
188- Console . WriteLine ( geomQueryResult . Documents . Count ) ; // >>> 1
189- var res = string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) ) ;
190+ Console . WriteLine ( geomQueryResult . Documents . Count ) ; // >>> 1
191+ var res = string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) ) ;
190192
191- Console . WriteLine (
192- string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) )
193- ) ;
194- // >>> [{"name":"Purple Point","geom":"POINT (2 2)"}]
193+ Console . WriteLine (
194+ string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) )
195+ ) ;
196+ // >>> {"name":"Purple Point","geom":"POINT (2 2)"}
197+ // REMOVE_START
198+ Assert . Single ( geomQueryResult . Documents ) ;
199+ Assert . Equal (
200+ "{\" name\" :\" Purple Point\" ,\" geom\" :\" POINT (2 2)\" }" ,
201+ string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) )
202+ ) ;
203+ // REMOVE_END
204+ }
195205 // STEP_END
196- // REMOVE_START
197- Assert . Single ( geomQueryResult . Documents ) ;
198- Assert . Equal (
199- "{\" name\" :\" Purple Point\" ,\" geom\" :\" POINT (2 2)\" }" ,
200- string . Join ( ", " , geomQueryResult . Documents . Select ( x => x [ "json" ] ) )
201- ) ;
202- // REMOVE_END
203206 // HIDE_START
204207 }
205208}
0 commit comments