Skip to content

Instantly share code, notes, and snippets.

@janakact
Created October 20, 2016 14:33
Show Gist options
  • Save janakact/ee59fbe83b2b4403f6129e235ae427ad to your computer and use it in GitHub Desktop.
Save janakact/ee59fbe83b2b4403f6129e235ae427ad to your computer and use it in GitHub Desktop.
searcher = new IndexSearcher(DirectoryReader.open(writer));
// DPoints within 30 km from colombo city
TopDocs docs = searcher.search(LatLonPoint.newDistanceQuery(LOCATION_TAG, COLOMBO_LAT,COLOMBO_LON, 30000), 5);
System.out.println("Within 30km");
printRecords(docs);
// DPoints within 20 km from colombo city
docs = searcher.search(LatLonPoint.newDistanceQuery(LOCATION_TAG, COLOMBO_LAT,COLOMBO_LON, 20000), 5);
System.out.println("\nWithin 20km");
printRecords(docs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment