You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by blmak <bl...@gmail.com> on 2013/05/24 17:10:55 UTC

multivalue location_rpt field not indexing with JSON format

Hi
 I am trying to index a multivalue lat/long values in the location_rpt field
from a json file, and I am getting the following error, when I attempt to
index a json file:

{"responseHeader":{"status":400,"QTime":5},"error":{"msg":"ERROR:
[doc=054ac6377d6ca4ad387f73b063000910] Error adding field
'location'='[33.448448009999999897, -111.988400740000003]'
msg=null","code":400}}

So, I have added the following to my schema.xml:

<field name="location"  type="location_rpt"  indexed="true" stored="true" 
multiValued="true" /> 

<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType" geo="true" units="degrees"
distErrPct="0.025" maxDistErr="0.000009" />


And here is a truncated example of the JSON I am trying to index:

[{"id":"054ac6377d6ca4ad387f73b063000910","keywords":["time", "trouble",
"exactly"],"description":"a anno is an anno is an anno",
"location":[[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],
[40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003]]},
...]

I am running solr-4.3.0. Any ideas/directions that I can go to get this to
work? From the documentation, it appears that the spatial field
functionality should work with Apache 4.3.0. Is there a library/extension
that I am missing? Does multivalue just mean one lat/one lng? 

Thanks for any assistance.
-barbra 



--
View this message in context: http://lucene.472066.n3.nabble.com/multivalue-location-rpt-field-not-indexing-with-JSON-format-tp4065935.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: multivalue location_rpt field not indexing with JSON format

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Hi Barbra,

Solr needs to see a String for each point value, not a 2-element array. 
Your doc should look like:

[{"id":"054ac6377d6ca4ad387f73b063000910","keywords":["time", "trouble",
"exactly"],"description":"a anno is an anno is an anno",
"location":["33.448448009999999897,-111.988400740000003","33.448448009999999897,-111.988400740000003","33.448448009999999897,-111.988400740000003",  
... etc.

~ David


blmak wrote
> Hi
>  I am trying to index a multivalue lat/long values in the location_rpt
> field from a json file, and I am getting the following error, when I
> attempt to index a json file:
> 
> {"responseHeader":{"status":400,"QTime":5},"error":{"msg":"ERROR:
> [doc=054ac6377d6ca4ad387f73b063000910] Error adding field
> 'location'='[33.448448009999999897, -111.988400740000003]'
> msg=null","code":400}}
> 
> So, I have added the following to my schema.xml:
> <field name="location"  type="location_rpt"  indexed="true" stored="true" 
> multiValued="true" />
>  
> <fieldType name="location_rpt"
> class="solr.SpatialRecursivePrefixTreeFieldType" geo="true"
> units="degrees" distErrPct="0.025" maxDistErr="0.000009" />
> 
> And here is a truncated example of the JSON I am trying to index:
> 
> [{"id":"054ac6377d6ca4ad387f73b063000910","keywords":["time", "trouble",
> "exactly"],"description":"a anno is an anno is an anno",
> "location":[[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],
> [40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[33.448448009999999897,-111.988400740000003],[40.732202530000002128,-73.925320569999996678],[33.448448009999999897,-111.988400740000003]]},
> ...]
> 
> I am running solr-4.3.0. Any ideas/directions that I can go to get this to
> work? From the documentation, it appears that the spatial field
> functionality should work with Apache 4.3.0. Is there a library/extension
> that I am missing? Does multivalue just mean one lat/one lng? 
> 
> Thanks for any assistance.
> -barbra





-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/multivalue-location-rpt-field-not-indexing-with-JSON-format-tp4065935p4065937.html
Sent from the Solr - User mailing list archive at Nabble.com.