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 Peter Wolanin <pe...@acquia.com> on 2011/09/03 04:39:50 UTC

any docs on using the GeoHashField?

looking at http://wiki.apache.org/solr/SpatialSearchDev

I would think I could index a lat,lon pair into a GeoHashField (that
works) and then retrieve the field value to see the computed geohash.

however, that doesn't seem to work.  If I index:  21.4,33.5

The retrieved value is not a hash, but approximately the same lat,lon:
<str name="geos_test">21.40000001527369,33.4999998472631</str>

If I try to filter on a geohash, &fq=geos_test:sezcd*  that works, so
I guess the hash is stored internally.

What am I missing - how can I retrieve the hash?

-Peter

-- 
Peter M. Wolanin, Ph.D.      : Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com : 781-313-8322

"Get a free, hosted Drupal 7 site: http://www.drupalgardens.com"

Re: any docs on using the GeoHashField?

Posted by Peter Wolanin <pe...@acquia.com>.
When I retrieve the value the lat/lon pair that comes out is not
exactly the same as what I indexed, which made be think it was
actually stored as the hash and then transformed back?

Anyhow - I'm trying to understand the actual use case for the field as
it exists - essentially you are saying I could query with a geohash
and use data in this field type to do a distance-based filter from the
lat,lon point corresponding to the geohash?

-Peter

On Thu, Sep 8, 2011 at 5:34 PM, Chris Hostetter
<ho...@fucit.org> wrote:
>
> : I would think I could index a lat,lon pair into a GeoHashField (that
> : works) and then retrieve the field value to see the computed geohash.
>        ...
> : What am I missing - how can I retrieve the hash?
>
> I don't think it's designed to work that way.
>
> GeoHashField provides GeoHash based search support for lat/lon values
> through it's internal (indexed) representaiton -- much like TrieLongField
> provides efficient range queries using trie encoding -- but the "stored"
> value is still the lat/lon pair (just as a TrieLongField is still the long
> value)
>
> If you want to store/retrive a raq GeoHash string, i think you have to
> compute it yourself (or put the logic in an UpdateProcessor).
>
> org.apache.lucene.spatial.geohash.GeoHashUtils should take care of all the
> heavy lifting for you.
>
> -Hoss
>



-- 
Peter M. Wolanin, Ph.D.      : Momentum Specialist,  Acquia. Inc.
peter.wolanin@acquia.com : 781-313-8322

"Get a free, hosted Drupal 7 site: http://www.drupalgardens.com"

Re: any docs on using the GeoHashField?

Posted by Chris Hostetter <ho...@fucit.org>.
: I would think I could index a lat,lon pair into a GeoHashField (that
: works) and then retrieve the field value to see the computed geohash.
	...
: What am I missing - how can I retrieve the hash?

I don't think it's designed to work that way. 

GeoHashField provides GeoHash based search support for lat/lon values 
through it's internal (indexed) representaiton -- much like TrieLongField 
provides efficient range queries using trie encoding -- but the "stored" 
value is still the lat/lon pair (just as a TrieLongField is still the long 
value)

If you want to store/retrive a raq GeoHash string, i think you have to 
compute it yourself (or put the logic in an UpdateProcessor).  

org.apache.lucene.spatial.geohash.GeoHashUtils should take care of all the 
heavy lifting for you.

-Hoss