My solr index has a field called "author_geo" which contains the author's
location, and when I am trying to get all docs whose author are within 10
km of 35.0,35.0 using the following query.

curl '
http://localhost/solr/select?q=*:*&fq={!geofilt%20sfield=author_geo}&pt=35.0,35.0&d=10&wt=json&indent=true&fl=author_geo
'

I got one "match" document which actually has no value of author_geo.

{
  "responseHeader":{
    "status":0,
    "QTime":7,
    "params":{
      "d":"10",
      "fl":"author_geo",
      "indent":"true",
      "q":"*:*",
      "pt":"35.0,35.0",
      "wt":"json",
      "fq":"!geofilt sfield=author_geo"}},
  "response":{"numFound":1,"start":0,"maxScore":1.0,"docs":[
      {}]
  }}


But if I run the following query to do a sorting, it shows clearly that
there are at least 6 docs which are within 10km of 35.0,35.0.

curl '
http://localhost/solr/select?q=*:*&sort=geodist(author_geo,35,35)+asc&wt=json&indent=true&fl=author_geo,geodist(author_geo,35,35)&fq=author_geo
:\[0,0%20TO%20360,360\]'

{
  "responseHeader":{
    "status":0,
    "QTime":10,
    "params":{
      "fl":"author_geo,geodist(author_geo,35,35)",
      "sort":"geodist(author_geo,35,35) asc",
      "indent":"true",
      "q":"*:*",
      "wt":"json",
      "fq":"author_geo:[0,0 TO 360,360]"}},
  "response":{"numFound":78133,"start":0,"docs":[
      {
        "author_geo":"34.991199,34.991199",
        "geodist(author_geo,35,35)":1.2650756688780775},
      {
        "author_geo":"34.991199,34.991199",
        "geodist(author_geo,35,35)":1.2650756688780775},
      {
        "author_geo":"34.991199,34.991199",
        "geodist(author_geo,35,35)":1.2650756688780775},
      {
        "author_geo":"35.032242,35.032242",
        "geodist(author_geo,35,35)":4.634071252404282},
      {
        "author_geo":"35.04644,35.04644",
        "geodist(author_geo,35,35)":6.674485609316976},
      {
        "author_geo":"35.060379,35.060379",
        "geodist(author_geo,35,35)":8.67754019129343},
      {
        "author_geo":"34.924019,34.924019",
        "geodist(author_geo,35,35)":10.923479728441448},
      {
        "author_geo":"34.89296,34.89296",
        "geodist(author_geo,35,35)":15.389876355902395},
      {
        "author_geo":"34.89296,34.89296",
        "geodist(author_geo,35,35)":15.389876355902395},
      {
        "author_geo":"35.109669,35.109669",
        "geodist(author_geo,35,35)":15.759483283896515}]
  }}

Can anyone tell me if anything is wrong here?  I am using Solr 4.4.

Thanks,
Ming-

Reply via email to