Results 1 to 1 of 1
- 06-28-2009, 01:10 AM #1Member
- Join Date
- Jun 2009
- Rep Power
SpatialQuery for location based search using Lucene
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);
Term lowerLongitude = new Term("longitude", bounds.West.ToString());
Term upperLongitude = new Term("longitude", bounds.East.ToString());
RangeQuery longitudeRangeQuery = new RangeQuery(lowerLongitude, upperLongitude, true);
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
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?
- By talk_to_vivekmishra in forum CDC and Personal ProfileReplies: 3Last Post: 12-30-2010, 11:07 AM
- By gopalbisht in forum Java SoftwareReplies: 1Last Post: 04-20-2009, 01:54 PM
- By vjay104 in forum Jobs OfferedReplies: 0Last Post: 01-18-2009, 06:29 AM
- By talk_to_vivekmishra in forum CLDC and MIDPReplies: 0Last Post: 08-14-2007, 08:23 AM