|
23 | 23 | <FormalSpec>indexGlobal:%String,queryType:%String,queryParams:%Binary</FormalSpec> |
24 | 24 | <ReturnType>%Status</ReturnType> |
25 | 25 | <Implementation><![CDATA[ |
26 | | -//for now we only have queryType = window |
27 | | -for i = 1:1:4 { |
28 | | -set item = $Piece(queryParams, ",", i) |
29 | | -set param = $Piece(item, "=", 1) |
30 | | -set value = $Piece(item, "=" ,2) |
31 | | -set arg(param) = value |
32 | | -} |
33 | | -//set rset = ##class(%ResultSet).%New("SpatialIndex.QueryExecutor:FindWindow") |
34 | | - //do rset.Execute(indexGlobal,arg("minx"),arg("miny"),arg("maxx"),arg("maxy")) |
35 | | - //while (rset.Next()){ |
36 | | - // set id = rset.Get("Id") |
| 26 | +if queryType = "window" { |
| 27 | +for i = 1:1:4 { |
| 28 | +set item = $Piece(queryParams, ",", i) |
| 29 | +set param = $Piece(item, "=", 1) |
| 30 | +set value = $Piece(item, "=" ,2) |
| 31 | +set arg(param) = value |
| 32 | +} |
| 33 | +//set rset = ##class(%ResultSet).%New("SpatialIndex.QueryExecutor:FindWindow") |
| 34 | + //do rset.Execute(indexGlobal,arg("minx"),arg("miny"),arg("maxx"),arg("maxy")) |
| 35 | + //while (rset.Next()){ |
| 36 | + // set id = rset.Get("Id") |
37 | 37 | set qHandle("indexGlobal") = indexGlobal |
38 | 38 | do ##class(SpatialIndex.QueryExecutor).InternalFindWindow(.qHandle,arg("minx"),arg("miny"),arg("maxx"),arg("maxy")) |
39 | 39 | set id = "" |
|
43 | 43 | set tChunk = (id\64000)+1, tPos=(id#64000)+1 |
44 | 44 | set $BIT(i%ResultBits(tChunk),tPos) = 1 |
45 | 45 | } |
46 | | - quit $$$OK |
| 46 | +}elseif queryType = "radius" { |
| 47 | +/* |
| 48 | +SELECT * |
| 49 | +FROM SpatialIndex.Test |
| 50 | +WHERE %ID %FIND search_index(x1F,'radius','x=55,y=55,radius=100m') |
| 51 | + and name %StartsWith 'Z' |
| 52 | + */ |
| 53 | + for i = 1:1:$L(queryParams, ",") { |
| 54 | +set item = $Piece(queryParams, ",", i) |
| 55 | +set param = $Piece(item, "=", 1) |
| 56 | +set value = $Piece(item, "=" ,2) |
| 57 | +set arg(param) = value |
| 58 | +} |
| 59 | +set qHandle("indexGlobal") = indexGlobal |
| 60 | +set arg("radiusX") = $G(arg("radiusX"),arg("radius")) |
| 61 | +set arg("radiusY") = $G(arg("radiusY"),arg("radius")) |
| 62 | + do ##class(SpatialIndex.QueryExecutor).InternalFindRadius(.qHandle,arg("x"),arg("y"),arg("radiusX"),arg("radiusY")) |
| 63 | + set id = "" |
| 64 | + for { |
| 65 | + set id = $O(qHandle("data", id)) |
| 66 | + quit:id="" |
| 67 | + set tChunk = (id\64000)+1, tPos=(id#64000)+1 |
| 68 | + set $BIT(i%ResultBits(tChunk),tPos) = 1 |
| 69 | + } |
| 70 | +} |
| 71 | +quit $$$OK |
47 | 72 | ]]></Implementation> |
48 | 73 | </Method> |
49 | 74 |
|
|
0 commit comments