Spatial types and DIH

2010-06-23 Thread Eric Angel
I'm using solr 4.0-2010-06-23_08-05-33 and can't figure out how to add the 
spatial types (LatLon, Point, GeoHash or SpatialTile) using dataimporthandler.  
My lat/lngs from the database are in separate fields.  Does anyone know how to 
do his?

Eric

Re: Spatial types and DIH

2010-06-28 Thread Eric Angel
Yes.  For now, I've gone back to Lucene 1.4 and installed Local Lucene.  I just 
couldn't get the sfilt to work.  I'm sure I was probably missing something, but 
I think I'll just wait until 1.5 is ready to be shipped.


On Jun 28, 2010, at 12:02 PM, Grant Ingersoll wrote:

> 
> On Jun 24, 2010, at 12:32 AM, Eric Angel wrote:
> 
>> I'm using solr 4.0-2010-06-23_08-05-33 and can't figure out how to add the 
>> spatial types (LatLon, Point, GeoHash or SpatialTile) using 
>> dataimporthandler.  My lat/lngs from the database are in separate fields.  
>> Does anyone know how to do his?
> 
> Can you concat the two fields together as part of your SQL statement?



MySQL + DIH + SpatialSearch

2011-01-24 Thread Eric Angel
I had difficulties getting this to work, so hopefully this will help others
having the same issue.

My environment:

Solr 3.1
MySQL 5.0.77

Schema:
 



DIH data-config:



I kept getting build errors similar to this:

org.apache.solr.common.SolrException:
org.apache.lucene.spatial.tier.InvalidGeoException: incompatible dimension
(2) and values ([B@2964a05d).  Only 0 values specified
at org.apache.solr.schema.PointType.createFields(PointType.java:77)
at org.apache.solr.update.DocumentBuilder.addField(DocumentBuilder.java:199)
at 
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:277)
at 
org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProc
essorFactory.java:60)
at org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:73)
at 
org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHand
ler.java:291)
at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:
625)
at 
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:265
)
at 
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:184)
at 
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.ja
va:335)
at 
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:393
)
at 
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:374)
Caused by: org.apache.lucene.spatial.tier.InvalidGeoException: incompatible
dimension (2) and values ([B@2964a05d).  Only 0 values specified
at 
org.apache.lucene.spatial.DistanceUtils.parsePoint(DistanceUtils.java:376)
at org.apache.solr.schema.PointType.createFields(PointType.java:75)

This would happen regardless of whether I used PointType, LatLonType, or
GeoHashField.

So I thought maybe I should pay attention to what the error says -
"incompatible dimension (2) and values ([B@2964a05d).  Only 0 values
specified".  Looking at the code, this revealed that it's trying to parse
"B@2964a05d" into a spatial field.  So my DIH was getting bad values ­
apparently, there's a bug in MySQL 5.0:
http://bugs.mysql.com/bug.php?id=12030 ­ where concat changes the character
set to binary.

To solve this, you can either:
* upgrade to MySQL 5.5 (according to the bug page, it was fixed in 5.5, but
I haven't tested it).
* Or you can typecast before you concat:
> * 

Eric