In my last blog post i explained about Geospatial Radial Search using Lucene 4.x. In continuation with this i am going to explain how to implement GeoSpatial Bounding Box Search using Lucene 4.x. Problem I am trying to Implement : Finding All Places Within Given Bounding Box. Sample Input Places Data : id name latitude longitude //Bangalore places 1 Bangalore 12.9558 77.620979 2 Cubbon Park 12.974045 77.591995 3 Tipu Palace 12.959365 77.573792 4 Bangalore Palace 12.998095 77.592041 5 Monkey Bar 12.97018 77.61219 //Chennai places 6 Chennai 13.060422 80.249583 7 Elliot's Beach 12.998976 80.271286 8 Kapaleeshwar Temple 13.033889 80.269722 Code : import java.io.File; import java.io.IOException; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.
In this blog post, i am going to explain how to implement GeoSpatial Search using Lucene 4.x. Problem I am trying to Implement : Finding Nearest Places Within Certain Radius Given the Location of User. Sample Input Places Data : id name latitude longitude 1 Bangalore 12.9558 77.620979 2 Cubbon Park 12.974045 77.591995 3 Tipu Palace 12.959365 77.573792 4 Bangalore Palace 12.998095 77.592041 5 Monkey Bar 12.97018 77.61219 6 Cafe Cofee Day 12.992189 80.2348618 Code : import java.io.File; import java.io.IOException; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.Field.Store; import org.apache.lucene.document.FieldType; import org.apache.lucene.document.IntField; import org.apache.lucene.document.Sto