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 Jason Cunning <jc...@ucar.edu> on 2012/04/24 22:05:15 UTC

embedded solr populating field of type LatLonType

Hi,

I have a question concerning the spatial field type LatLonType and populating it via an embedded solr server in java.

So far I've only ever had to index simple types like boolean, float, and string. This is the first complex type. So I'd like to use the following field definition for example in my schema:

<field name="coordinate" type="LatLonType" indexed="true" stored="false" multiValued="false"/>

And then I'd like to populate this field in java as in the following psuedo code:

public SolrInputDocument populate(AppropriateJavaType coordinate) {

    SolrInputField inputField = new SolrInputField("coordinate");
    inputField.addValue(coordinate, 1.0F);

    SolrInputDocument inputDocument = new SolrInputDocument();
    inputDocument.put("coordinate", inputField);                

    return inputDocument;
}

My question is, what is the AppropriateJavaType for populating a solr field of type LatLonType?

Thank you for your time.

Re: embedded solr populating field of type LatLonType

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Tue, Apr 24, 2012 at 4:05 PM, Jason Cunning <jc...@ucar.edu> wrote:
> My question is, what is the AppropriateJavaType for populating a solr field of type LatLonType?

A String with both the lat and lon separated by a comma.  Example: "12.34,56.78"

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10