embedded solr populating field of type LatLonType

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

embedded solr populating field of type LatLonType

Jason Cunning
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.
Reply | Threaded
Open this post in threaded view
|

Re: embedded solr populating field of type LatLonType

Yonik Seeley-2-2
On Tue, Apr 24, 2012 at 4:05 PM, Jason Cunning <[hidden email]> 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