-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Spatial DSL search
PostPosted: Fri Dec 17, 2010 2:09 pm 
Newbie

Joined: Tue Nov 04, 2008 8:53 am
Posts: 3
Hi,

I am trying to integrate Hibernate Search and lucene spatial using the DSL query api though I am not sure if this is even possible. I am using:

Hibernate Core 3.6.0
Hibernate Search 3.3.0
Lucene Core 3.0.2
Lucene Spatial 3.0.2

I created the annotation for the geohash property as such:

Code:
   @Transient
   @Field(index = Index.UN_TOKENIZED, store = Store.YES, name = "geohash")
   public String getGeohash() {
      return GeoHashUtils.encode(latitude, longitude);
   }   


Now, I wanted to create a query object but I was not sure the best way to go about doing it. This was my last attempt:

Code:
   FullTextSession fullTextSession = Search.getFullTextSession(session);
   DistanceQueryBuilder distanceQueryBuilder = new DistanceQueryBuilder(lat,longitude, distance,"geohash",CartesianTierPlotter.DEFALT_FIELD_PREFIX, true);
        Query query = fullTextSession.createFullTextQuery(new ConstantScoreQuery(distanceQueryBuilder.getFilter()));


This returns no results. Is what I am trying to do possible, or do I need to do the search through the lucene api?

Michael


Top
 Profile  
 
 Post subject: Re: Spatial DSL search
PostPosted: Sun Dec 19, 2010 7:54 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Michael,
it should be possible, but it seems to me that your example is mixing two different techniques to do geolocalization search which are incompatible.

The encoding method is using Geohashtag, and puts the single term result in the field "geohash", but the Query you perform is expecting a different encoding, and also uses prefixed to search across differently named fields.

In case you want to go for the Geohash, then encoding should be fine you only have to review the way you define the Lucene Query; in case you opt for one of the approaches using multiple fields then you have to change the encoding in such a way you create the multiple fields, you need to define an appropriate FieldBridge; Here you can find and example of a FieldBridge encoding a value into multiple fields.

Please correct me if I'm wrong, I didn't look much into Lucene Spatial yet.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.