MQL Search on indexed field in user view returns empty user entity resultset

0 views
Skip to first unread message

sean

unread,
Feb 10, 2010, 4:11:48 PM2/10/10
to GeoAPI
I'm trying to execute an MQL search query on an indexed field, such
that the query will return only the user entities that are associated
with a given user view. However, I am continually receiving an empty
resultset.

Here are the steps that I've followed:

1. Created two user entities ('Location A', and 'Location B') both of
which are within a 1km radius of a given lat/lng.

2. 'Location A' was created as a user entity...

--Request--
{
"name": "location-a",
"geom": {
"type": "Point",
"coordinates": [
2.35219,
48.861129
]
}
}

--Response--
{
"query": {
"type": "entity",
"params": {
"guid": "user-XXXXXX-location-a",
"show-geom": "all"
}
},
"result": {
"name": "location-a",
"views": [
"weather",
"foursquare",
"twitter",
"flickr",
"youtube"
],
"userviews": [

],
"shorturl": "http://geo.am/NILQN0",
"geom": {
"type": "Point",
"coordinates": [
2.35219,
48.861129
]
},
"type": "user-entity"
}
}

3. ...then 'Location A' was associated with a user view named
"whereami"

-- Request--
{
"name": "Location A",
"summary": "summary",
"description": "description",
"info": "info",
"entryType": "test"
}

--Response--
{
"query": {
"type": "entity-view",
"params": {
"userview": "whereami",
"guid": "user-XXXXXX-location-a"
}
},
"result": {
"entries": [
{
"date": "2010-02-10T16:06:13Z",
"data": {
"info": "info",
"description": "description",
"summary": "summary",
"entryType": "test",
"name": "Location A"
},
"id": "HfMlCFnk"
}
]
}
}

3. 'Location B' was created as an app specific entity, but was not
associated with a user view

--Request--
http://localhost/invoke?geotype=entity
{
"name": "location-b",
"geom": {
"type": "Point",
"coordinates": [
2.354679,
48.86127
]
}
}

--Response--
{
"query": {
"type": "entity",
"params": {
"guid": "user-XXXXXX-location-b",
"show-geom": "all"
}
},
"result": {
"name": "location-b",
"views": [
"weather",
"foursquare",
"twitter",
"flickr",
"youtube"
],
"userviews": [

],
"shorturl": "http://geo.am/ZOpmlw",
"geom": {
"type": "Point",
"coordinates": [
2.354679,
48.86127
]
},
"type": "user-entity"
}
}


4. Next, I indexed the "entryType" field in the "whereami" user view
by executing the following command:

curl -v -d @indextest.json -X POST "http://api.geoapi.com/v1/options/
userview/whereami?apikey=XXXXXXXX

-here is the JSON that was contained in the indextest.json file-

{"fields": {"entryType": {"index-as": "string"}}}


-and here is the output from the curl command-

* About to connect() to api.geoapi.com port 80 (#0)
* Trying 174.129.10.216... connected
* Connected to api.geoapi.com (174.129.10.216) port 80 (#0)
> POST /v1/options/userview/whereami?apikey=XXXXXX HTTP/1.1
> User-Agent: curl/7.19.5 (i586-pc-mingw32msvc) libcurl/7.19.5 zlib/1.2.3
> Host: api.geoapi.com
> Accept: */*
> Content-Length: 49
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Date: Wed, 10 Feb 2010 16:20:53 GMT
< Content-Type: application/json
< Connection: keep-alive
< Content-Length: 49
< Expires: Thu, 11 Feb 2010 16:20:53 GMT
< Cache-Control: max-age=86400
< Server: TornadoServer/0.1
<
{"fields": {"entryType": {"index-as": "string"}}}* Connection #0 to
host api.geo
api.com left intact
* Closing connection #0


5. Next, I executed the following search query just to verify the two
newly created user entities exist within the specified radius of the
given lat/lng location. As expected, the two locations were within
the specified radius and "Location A" was associated with the
"whereami" user view, while "Location B" was not.

-Request-
http://api.geoapi.com/v1/search?lat=48.86127041301128&lon=2.3534345626831055&radius=0.4km&apikey=XXXXXX&pretty=1

-Response-
{
"query": {
"type": "search",
"params": {
"lon": 2.35343456268311,
"show-geom": "all",
"num-results": 2,
"lat": 48.8612704130113,
"radius-in-meters": 400,
"type": "any",
"include-parents": false
}
},
"result": [
{
"distance-in-meters": 91,
"guid": "user-XXXXXX-location-b",
"meta": {
"name": "location-b",
"views": [
"weather",
"foursquare",
"twitter",
"flickr",
"youtube"
],
"userviews": [],
"shorturl": "http://geo.am/ZOpmlw",
"geom": {
"type": "Point",
"coordinates": [
2.354679,
48.86127
]
},
"type": "user-entity"
}
},
{
"distance-in-meters": 92,
"guid": "user-XXXXXX-location-a",
"meta": {
"name": "location-a",
"views": [
"weather",
"foursquare",
"twitter",
"flickr",
"youtube"
],
"userviews": [
"whereami"
],
"shorturl": "http://geo.am/NILQN0",
"geom": {
"type": "Point",
"coordinates": [
2.35219,
48.861129
]
},
"type": "user-entity"
}
}
]
}


6. Lastly, I executed the following MQL query with the intent of
filtering out "Location B" from the response since it is not
associated with the "whereami" user view. However, the issue is that
nothing is getting returned.

-Request-
http://api.geoapi.com/v1/q?q={"lat":48.86127041301128,"lon":2.3534345626831055,"radius":"0.3km","entity":[{"guid":null,"name":null,"geom":null,"distance-from-origin":null,"type":"user-entity","userview.whereami":{"entries":[{"data":{"entryType":"test"}}]}}]}&apikey=XXXXXX

-Response-
{
"lat": :48.86127041301128,
"radius": "0.3km",
"lon": 2.3534345626831055,
"entity": [

]
}


The response always come back with an empty entity resultset. I've
read through a couple of other threads in this group about similar
issues, and they helped provide some guidance but I can't seem to get
this working. Any help would be appreciated.

sean

unread,
Feb 15, 2010, 3:20:08 PM2/15/10
to GeoAPI
Can anyone in support provide insight on this issue?

> --Request--http://localhost/invoke?geotype=entity

> -Request-http://api.geoapi.com/v1/search?lat=48.86127041301128&lon=2.353434562...

> -Request-http://api.geoapi.com/v1/q?q={"lat":48.86127041301128,"lon":2.3534345626831055,"radius":"0.3km","entity" :[{"guid":null,"name":null,"geom":null,"distance-from-origin":null,"type":" user-entity","userview.whereami":{"entries":[{"data":{"entryType":"test"}}] }}]}&apikey=XXXXXX

Reply all
Reply to author
Forward
0 new messages