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 dm_tim <dm...@yahoo.com> on 2012/11/14 23:21:51 UTC

Solr 4.0 Spatial Search schema.xml and data-config.xml

Howdy,

I now want to try my hand a spatial search. It looks fairly easy but I'm a
bit puzzled about how to set up my schema.xml file. I know that my field
must use the LatLon type but the columns of the database where I'll be
pulling my data for indexing have separate lat and lon columns (both
double). 

I can't figure out how to write my entity tag in my data-config.xml to take
the two columns lon and lat (both double) and combine them so that I can put
them into a LonLat field. I haven't had much luck finding an example. Is
there one out there?

Regards,

Tim



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-Spatial-Search-schema-xml-and-data-config-xml-tp4020376.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr 4.0 Spatial Search schema.xml and data-config.xml

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
The particular JavaScript I referred to is this:

function processAdd(cmd) {

  doc = cmd.solrDoc;  // org.apache.solr.common.SolrInputDocument
  
  lat = doc.getFieldValue("LATITUDE");
  lon = doc.getFieldValue("LONGITUDE");
  
  if (lat != null && lon != null)
    doc.setField("latLon", lat+","+lon);

}



-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-Spatial-Search-schema-xml-and-data-config-xml-tp4020376p4020492.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr 4.0 Spatial Search schema.xml and data-config.xml

Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Tim,
  Combine them in "lat,lon" format using ScriptUpdateRequestProcessor using
JavaScript.  I'm doing this already in fact.  See a template of an example
that comes with Solr in update-script.js referenced by solrconfig.xml.  I'd
paste it right here if I had it but I have the excerpt for it on another
machine.

~ David Smiley



-----
 Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-Spatial-Search-schema-xml-and-data-config-xml-tp4020376p4020413.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr 4.0 Spatial Search schema.xml and data-config.xml

Posted by jmlucjav <jm...@gmail.com>.
If you are using DIH, is just doing (for a mysql project I have around for
example) something like this:

 CONCAT(lat, ',',lon) as latlon





--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-0-Spatial-Search-schema-xml-and-data-config-xml-tp4020376p4020437.html
Sent from the Solr - User mailing list archive at Nabble.com.