Results 1 to 1 of 1
- 06-28-2009, 01:10 AM #1
Member
- Join Date
- Jun 2009
- Posts
- 1
- Rep Power
- 0
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.
Similar Threads
-
i need an example of JSR179 ((Location based Ser)implementation for CDC based device
By talk_to_vivekmishra in forum CDC and Personal ProfileReplies: 3Last Post: 12-30-2010, 10:07 AM -
Need help in lucene with hibernate search
By gopalbisht in forum Java SoftwareReplies: 1Last Post: 04-20-2009, 01:54 PM -
Required Urgently PM/PL/TechLead (J2EE) for UK Based IT Co. (Location:- Baroda-GUJ.)
By vjay104 in forum Jobs OfferedReplies: 0Last Post: 01-18-2009, 05:29 AM -
(Location based Service) application for Pocket PC
By talk_to_vivekmishra in forum CLDC and MIDPReplies: 0Last Post: 08-14-2007, 08:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks