Your SlideShare is downloading. ×
0
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Geospatial search with SOLR
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Geospatial search with SOLR

9,702

Published on

This was my presentation for Drupalcamp Gent 2012. Presented on Friday May 25, 2012.

This was my presentation for Drupalcamp Gent 2012. Presented on Friday May 25, 2012.

Published in: Technology
2 Comments
9 Likes
Statistics
Notes
No Downloads
Views
Total Views
9,702
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
2
Likes
9
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Geospatial search with SOLR Nicolas Leroy
  • 2. Geospatial search with SOLR
  • 3. Who am I?Nicolas Leroy - AUSY/DataflowTwitter: nicolasleroyDrupal.org: http://drupal.org/user/3527
  • 4. SOLR
  • 5. SOLRSolr is the popular, blazing fast open sourceenterprise search platform from the ApacheLucene project.Its major features include powerful full-textsearch, hit highlighting, faceted search,dynamic clustering, database integration, richdocument handling, and geospatial search.Solr is written in Java
  • 6. SOLRMore information:http://lucene.apache.org/solr/
  • 7. SOLRSingle core vs MulticoreOne index vs Multiple indexes
  • 8. Multicore
  • 9. MulticoreStartup script:cd /Applications/apache-solr-3.5.0/serverjava -Dsolr.solr.home=multicore -jar start.jar
  • 10. Geospatial search
  • 11. Geospatial search: definitionwikipedia:Geomatics (also known as geospatialtechnology or geomatics engineering) is thediscipline of gathering, storing, processing, anddelivering geographic information, orspatially referenced information.
  • 12. Latitude and longitude
  • 13. Latitude and longitudeLatitude = horizontal linesLongitude = vertical lines
  • 14. World map
  • 15. Geolocation
  • 16. Geolocation: ground markSurveyor-General Victoria (SGV) is responsiblefor Victoria’s Geodetic Survey Control Network.This is the infrastructure used to provideaccurate position and height referencing acrossVictoria. It is made up of 140,000 ground markshttp://www.dse.vic.gov.au/property-titles-and-maps/surveying-home-page/government-survey-services/victorias-survey-infrastructure
  • 17. Drupal + SOLR
  • 18. Drupal + SOLR: modules•  search_api + search_api_solr•  apachesolr
  • 19. Geospatial Options•  geofield + geocoder + search_api + search_api_location•  location + search_api + search_api_location•  location + gmap + apachesolr + apachesolr_location•  apachesolr_geo still a sandbox, not much information.
  • 20. Drupal + SOLRDrupal:http://drupal.org/startApachesolr modulehttp://drupal.org/project/apachesolrDownload SOLR:http://www.apache.org/dyn/closer.cgi/lucene/ solr/3.6.0
  • 21. Drupal + SOLRNice tutorial:http://www.nickveenhof.be/blog/simple-guide- install-apache-solr-3x-drupal-7Check his blog for screencasts:http://www.nickveenhof.be/
  • 22. Our Story•  Drupal site•  Using SOLR with apachesolr module•  Location moduleProblem:Location information wasnt indexed
  • 23. Drupal: Location moduleThe Location module allows real-worldgeographic locations to be associated withDrupal nodes.http://drupal.org/project/location
  • 24. Location in actionhttp://drupal7.local:8080/node/1/edit
  • 25. Why not indexed?SOLR doesnt know what to do with this customfield.And this field contains multiple values (street,city, province, country,...)
  • 26. SolutionWe wrote some custom code to:•  index location information properly•  generate facets•  provide a search form for geospatial search (longitude, latitude + radius)We changed schema.xml to use a"solr.LatLonType" field.
  • 27. Schema?
  • 28. Schema.xml?The schema.xml file contains all of the detailsabout which fields your documents cancontain, and how those fields should be dealtwith when adding documents to the index, orwhen querying those fields.Schema.xml comes with the apachesolrmodule and is configured to handle drupalcontent.
  • 29. Schema.xml?<!-- A specialized field for geospatial search. Ifindexed, this fieldType must not be multivalued.--><fieldType name="location"class="solr.LatLonType"subFieldSuffix="_coordinate"/>
  • 30. Schema.xmlThis field is now included in schema.xml thatcomes with apachesolr module.
  • 31. Code
  • 32. Index location informationhook_apachesolr_update_index(&$document,$node) = DEPRECATEDNow use:hook_index_document_build_ENTITYTYPE
  • 33. Create new facetshook_facetapi_facet_info($searcher_info)
  • 34. apachesolr_location modulehttp://drupal.org/project/apachesolr_location
  • 35. Map fields
  • 36. Indexing callback
  • 37. Create facets
  • 38. Doing the geospatial searchAdding a part to the querystring whensearching:&spatial=[lat]_[long]_[radius]hook_apachesolr_query_alter($query)
  • 39. hook_apachesolr_query_alter$query->addParam(fq, "{!geofiltsfield=locs_coordinates" . " pt=" . $keys[0] . , .$keys[1] . " d=" . $distance . "}");{!geofilt sfield=locs_coordinates pt=50.879816,4.706429 d=10}
  • 40. Too hacky (via url)Should be done with querytypes.
  • 41. Small Demohttp://drupal7.local:8080
  • 42. Future?
  • 43. Future•  Adding city + radius box•  Getting coordinates of the city•  Search for items within that range•  Adding visualisation•  Settings UI: miles or km,…What would you add? Let us know!http://drupal.org/project/apachesolr_location
  • 44. Feedback & follow-up:http://drupalcampgent.be/feedback

×