-->
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.  [ 4 posts ] 
Author Message
 Post subject: Beginner question - simple spatial search
PostPosted: Mon Feb 14, 2011 8:23 am 
Newbie

Joined: Tue Nov 09, 2010 12:45 pm
Posts: 7
Hi,

I have been searching around for the last day (badly) to try to find some help on how to use Lucene-Spatial within my application.

I am using GWT so I would like to keep the client side clear of org.apache.* packages as GWT tries to serialise everything on the client side. (made this tutorial less useful : http://java.dzone.com/articles/spatial-search-hibernate?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+javalobby/frontpage+(Javalobby+/+Java+Zone))

Basically I have an address object with a field "latitude" and a field "longitude" and I would like to do distance searches against this, is lucene-spatial the right way to go or should I look more into doing it in another way?

So far I have got to :-

Code:
DistanceQueryBuilder dq = new DistanceQueryBuilder(new Double(point[1]), new Double(point[0]), 10d,
                  "activity_locationName_latitude", "activity_locationName_longitude",CartesianTierPlotter.DEFALT_FIELD_PREFIX, true);
            
            FullTextSession fullTextSession = Search.getFullTextSession(session);
            
            
            org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery( new ConstantScoreQuery(dq.getFilter()) );


But I dont understand what "CartesianTierPlotter.DEFALT_FIELD_PREFIX" is meant to actually be, and as such my result set comes back empty.

Cheers,
Rob


Top
 Profile  
 
 Post subject: Re: Beginner question - simple spatial search
PostPosted: Tue Feb 15, 2011 2:29 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
This is really more of a Lucene question than a Hibernate Search question. Have you tried asking the question on the lucene forum and/or mailing list.
Using a distance query sounds like the right thing to so, but personally I don't have any experience with the Lucene Spatial API. There might of course be something wrong with your Search setup, but given the context you gave it is hard to tell.

--Hardy


Top
 Profile  
 
 Post subject: Re: Beginner question - simple spatial search
PostPosted: Tue Feb 15, 2011 7:43 am 
Newbie

Joined: Tue Nov 09, 2010 12:45 pm
Posts: 7
Thanks for the quite reply. I think there is something wrong with my search setup. I am trying a slightly different approach now and have a hibernate related question instead. I will update here when I have it resolved. I started a new post for the other question as it is different enough, if you have a second to look at it it would certainly be appreciated :https://forum.hibernate.org/viewtopic.php?f=9&t=1009561

Cheers,
rob


Top
 Profile  
 
 Post subject: Re: Beginner question - simple spatial search
PostPosted: Tue Feb 15, 2011 8:28 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi, sorry I couldn't find a reference to the details, but I remember someone was using Spatial just fine with Search.
The way spatial works is by encoding x and y coordinates in two different fields, which have a name with a common prefix. This CartesianTierPlotter.DEFALT_FIELD_PREFIX should be the shared prefix (default), so basically to have it working you have to make sure the field names Search uses to index your entity match the field names the DistanceQueryBuilder is looking for: I'd suggest you log/debug DistanceQueryBuilder to find out the exact field names, and verify using Luke (nice tool to look into your index) that the field names you're using to encode x/y (latitude/longitude) are matching. (@Field annotation as a name attribute so you can override it for these purposes)

Shouldn't be hard, but still if you could post a working example as future reference for others that would be great.

_________________
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.  [ 4 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.