Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Spatial corridor search for Apache Solr.

License

NotificationsYou must be signed in to change notification settings

Indoqa/solr-spatial-corridor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This plugin offers functions to filter and sort results alongside a geographical route. It solves tasks like "I want to go from Vienna to Bratislava by car, please find all fuel stations that are max. 2 kilometers away from the computed route on the highway. Additionally, sort them by driven distance on the highway, starting in Vienna." To achieve this, the plugin introduces two dynamically created properties, given a query route as WKT LineString:

  • corridorDistance(latLonField): Normal (shortest) distance between the result and the route
  • corridorPosition(latLonField): The distance on the route between the start point and the projection of the result (= where the normal distance line intersects the route)

Solr spatial corridor legend

Example Use Cases

Filter by corridorDistance()

"Find all results with a maximum normal distance of 2 kilometers to the route"

Solr spatial corridor filter

?q={!corridor field=latLon buffer=2}  // a shortcut for {!frange l=0 u=2}corridorDistance(lanLon)&corridor.route=LINESTRING(16.37039615861895 48.20057128552842, 16.358677998093828 48.19719643770264, 16.339207685325686 48.188545501731866, 16.31468318513228 48.18773608789617, 16.28094963169427 48.192208688939225...

Sort by corridorDistance()

"Show all results, sort them by normal distance"

Solr spatial distance sort

?q=*:*&sort=corridorDistance(latLon) ASC&corridor.route=LINESTRING(16.37039615861895 48.20057128552842, 16.358677998093828 48.19719643770264, 16.339207685325686 48.188545501731866, 16.31468318513228 48.18773608789617, 16.28094963169427 48.192208688939225...

Sort by corridorPosition()

"Show all results, sort them by distance from startpoint alongside the route"

Solr spatial position sort

?q=*:*&sort=corridorPosition(latLon) ASC&corridor.route=LINESTRING(16.37039615861895 48.20057128552842, 16.358677998093828 48.19719643770264, 16.339207685325686 48.188545501731866, 16.31468318513228 48.18773608789617, 16.28094963169427 48.192208688939225...

Installation

Requirements

  • Apache Solr 4.9+ including JTS in /WEB-INF/lib (seewhy)
  • Java 7+

Build

  • Download the latest release
  • run "maven clean install"

Deployment

  • Copy the plugin jar from 'target/spatial-corridor--jar-with-dependencies.jar' into the /lib directory of your solr core.

Configuration

schema.xml

Store one or more geocoordinate(s) for each result in a field of type solr.LatLonType

<fieldTypename="location"class="solr.LatLonType"subFieldSuffix="_coordinate"/><fieldname="latLon"type="location"indexed="true"stored="true"multivalued="true|false"/>

solrconfig.xml

Define new ValueSourceParsers for corridorDistance() and corridorPosition() and the QueryParser for the !{corridor} shortcut:

<valueSourceParsername="corridorDistance"class="com.indoqa.solr.spatial.corridor.query.route.RouteDistanceValueSourceParser" /><valueSourceParsername="corridorPosition"class="com.indoqa.solr.spatial.corridor.query.route.RoutePositionValueSourceParser" />  <queryParsername="corridor"class="com.indoqa.solr.spatial.corridor.CorridorQueryParserPlugin" />

As WKT LineStrings are internally converted into JTS Geometry objects, a custom cache storing results of this conversion may be configured. The plugin scans for a cache namedcorridorLineStrings:

<query>  <cachename="corridorLineStrings"class="solr.LRUCache"size="4096"initialSize="2048"autowarmCount="2048"/></query>

About

Spatial corridor search for Apache Solr.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp