[Corona] Help with Corona Query
Ryan Grimm
grimm at xqdev.com
Mon Feb 27 08:09:48 PST 2012
Actually, if the DEBUG environment variable is set to "true", Corona will log the generated cts queries for you :). So just visit /config/env to setup DEBUG logging and that could help with future problems.
I didn't spot this at first (and perhaps even gave you a bad example in a previous email, apologies if I did), but the region keys aren't specifying what type of region should be created (e.g.: circle, square, polygon, point). So they should look like:
{
"and": [ {
"wordAnywhere": "a"
},{
"or":[{
"region":{
"circle": {
"longitude":-74.00597309999999,
"radius":1,
"latitude":40.7143528
}
},
"weight":10,
"geo":"geokey"
}
…
Notice the new "circle" key under "region" Give that a try and let us know if gets you on track.
--Ryan
On Feb 26, 2012, at 12:16 PM, Jason Hunter wrote:
> Ryan may be able to identify the issue visually, but here's what I'd do in your shoes...
>
> I'd add an xdmp:log to the Corona code to output the internal cts:query being constructed for execution. I'd confirm that it looks like it's doing the right thing.
>
> If it's not, well, that means it's an issue in your expression of the query or in the Corona code interpreting the query.
>
> If it's looks like it's doing the right thing, then I'd run the cts:query in QC to explore why the query isn't returning results as expected.
>
> -jh-
>
>
> On Feb 25, 2012, at 7:26 AM, Tom Hubschman wrote:
>
>> Hello,
>>
>> I have been struggling to get this query to work for the last couple of days and I was hoping that someone might have an idea. I got a lot of very helpful assistance from Ryan, but it still seems to not return the results I am looking for. I have confirmed that the index exists. You can see the schema for the XML files and the XML files themselves (via using the API) being queried here: http://staging.warriorgateway.org:8080/GINetworkAPI/
>>
>> Here is the creation POST for the query: curl -X POST "http://localhost:9092/manage/geospatial/LatLongIndex?parentElement=physical_address&latElement=latitude&longElement=longitude"
>>
>> Summary of what I am trying to achieve:
>>
>> Desired Results: Conduct a search using keywords and geolocation data where by the closer the result is to the location the higher up it is returned.
>> Actual Results: Both location and location seem to be ignored.
>>
>> Query:
>>
>> {
>> "and": [ {
>> "wordAnywhere": "a"
>> },{
>> "or":[{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":1,
>> "latitude":40.7143528
>> },
>> "weight":10,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":2,
>> "latitude":40.7143528
>> },
>> "weight":9,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":4,
>> "latitude":40.7143528
>> },
>> "weight":8,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":8,
>> "latitude":40.7143528
>> },
>> "weight":7,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":16,
>> "latitude":40.7143528
>> },
>> "weight":6,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":32,
>> "latitude":40.7143528
>> },
>> "weight":5,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":64,
>> "latitude":40.7143528
>> },
>> "weight":4,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":128,
>> "latitude":40.7143528
>> },
>> "weight":3,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":256,
>> "latitude":40.7143528
>> },
>> "weight":2,
>> "geo":"LatLongIndex"
>> },{
>> "region":{
>> "longitude":-74.00597309999999,
>> "radius":512,
>> "latitude":40.7143528
>> },
>> "weight":1,
>> "geo":"LatLongIndex"
>> }]
>> }]
>> }
>>
>> Any ideas?
>>
>> Tom
>>
>> --
>> Thomas Hubschman
>> Director, Engineering
>> tom.hubschman at warriorgateway.org
>> Mobile: (415) 612-0359
>> www.warriorgateway.org
>> _______________________________________________
>> Corona mailing list
>> Corona at developer.marklogic.com
>> http://developer.marklogic.com/mailman/listinfo/corona
>
> _______________________________________________
> Corona mailing list
> Corona at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/corona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/corona/attachments/20120227/e0b5e8f2/attachment-0001.html
More information about the Corona
mailing list