Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-28-2009, 02:10 AM
Member
 
Join Date: Jun 2009
Posts: 1
Rep Power: 0
simona is on a distinguished road
Default SpatialQuery for location based search using Lucene
Hi,

My lucene index has got latitude and longitudes fields indexed as follows:

doc.Add(new Field("latitude", latitude.ToString() , Field.Store.YES, Field.Index.UN_TOKENIZED));

doc.Add(new Field("longitude", longitude.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));


Term lowerLatitude = new Term("latitude", bounds.South.ToString() );
Term upperLatitude = new Term("latitude", bounds.North.ToString());
RangeQuery latitudeRangeQuery = new RangeQuery(lowerLatitude, upperLatitude, true);
findLocationQuery.Add(latitudeRangeQuery, BooleanClause.Occur.SHOULD);



Term lowerLongitude = new Term("longitude", bounds.West.ToString());
Term upperLongitude = new Term("longitude", bounds.East.ToString());
RangeQuery longitudeRangeQuery = new RangeQuery(lowerLongitude, upperLongitude, true);
findLocationQuery.Add(longitudeRangeQuery, BooleanClause.Occur.SHOULD);



Am facing another problem in this context:
I've one of the documents in the index with the following 3 cities:

- Lyons, IL

Oak Brook, IL

San Francisco, CA

If i give input as "Lyons, IL" then this record comes up when i execute the above search query in Lucene.
But if i give San Francisco, CA as input, then it does not.

However, if i store the cities for this document as follows:

- San Francisco, CA

Lyons, IL

Oak Brook, IL

and when i give San Francisco, CA as input, then this record shows in the search results.

What i want here is that if i type any of the 3 cities in input,I should get this document in the search results.

Is there anything wrong with my search query?
Please help.

Thanks.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in lucene with hibernate search gopalbisht Java Announcements 1 04-20-2009 02:54 PM
Required Urgently PM/PL/TechLead (J2EE) for UK Based IT Co. (Location:- Baroda-GUJ.) vjay104 Jobs Offered 0 01-18-2009 06:29 AM
i need an example of JSR179 ((Location based Ser)implementation for CDC based device talk_to_vivekmishra CDC and Personal Profile 1 06-22-2008 10:45 PM
(Location based Service) application for Pocket PC talk_to_vivekmishra CLDC and MIDP 0 08-14-2007 09:23 AM


All times are GMT +2. The time now is 04:52 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org