@@ -19,16 +19,17 @@ package org.zouzias.spark.lucenerdd.spatial.point
1919import com .twitter .algebird ._
2020import org .apache .lucene .document .Document
2121import org .apache .lucene .spatial .query .SpatialOperation
22- import org .apache .spark .{OneToOneDependency , Partition , TaskContext }
22+ import org .apache .spark .{OneToOneDependency , Partition , Partitioner , TaskContext }
2323import org .apache .spark .rdd .RDD
2424import org .apache .spark .sql .{DataFrame , Dataset , Row }
2525import org .apache .spark .storage .StorageLevel
26+ import org .zouzias .spark .lucenerdd .aggregate .{MaxPointMonoid , MinPointMonoid }
2627import org .zouzias .spark .lucenerdd .analyzers .AnalyzerConfigurable
2728import org .zouzias .spark .lucenerdd .config .ShapeLuceneRDDConfigurable
2829import org .zouzias .spark .lucenerdd .models .SparkScoreDoc
2930import org .zouzias .spark .lucenerdd .query .{LuceneQueryHelpers , SimilarityConfigurable }
3031import org .zouzias .spark .lucenerdd .response .{LuceneRDDResponse , LuceneRDDResponsePartition }
31- import org .zouzias .spark .lucenerdd .spatial .commons .{ MaxPointMonoid , MinPointMonoid }
32+ import org .zouzias .spark .lucenerdd .spatial .commons .SpatialByXPartitioner
3233import org .zouzias .spark .lucenerdd .spatial .point .PointLuceneRDD .PointType
3334import org .zouzias .spark .lucenerdd .spatial .point .partition .{AbstractPointLuceneRDDPartition , PointLuceneRDDPartition }
3435import org .zouzias .spark .lucenerdd .versioning .Versionable
@@ -198,7 +199,7 @@ class PointLuceneRDD[V: ClassTag]
198199 *
199200 * @param shapeWKT Shape in WKT format
200201 * @param k Number of element to return
201- * @param operationName
202+ * @param operationName Spatial operation name, i.e., intersection, contained, etc.
202203 * @return
203204 */
204205 def spatialSearch (shapeWKT : String , k : Int ,
@@ -213,7 +214,7 @@ class PointLuceneRDD[V: ClassTag]
213214 * @param center given as (x, y)
214215 * @param radius in kilometers (KM)
215216 * @param k
216- * @param operationName
217+ * @param operationName Spatial operation name, i.e., intersection, contained, etc.
217218 * @return
218219 */
219220 def bboxSearch (center : PointType , radius : Double , k : Int ,
@@ -228,7 +229,7 @@ class PointLuceneRDD[V: ClassTag]
228229 * @param lowerLeft Lower left corner
229230 * @param upperRight Upper right corner
230231 * @param k Number of results
231- * @param operationName Intersect , contained, etc.
232+ * @param operationName Spatial operation name, i.e., intersection , contained, etc.
232233 * @return
233234 */
234235 def bboxSearch (lowerLeft : PointType ,
@@ -257,6 +258,15 @@ class PointLuceneRDD[V: ClassTag]
257258 }
258259 }
259260
261+ /**
262+ * Returns an x-axis spatial [[Partitioner ]] that is used in link related methods
263+ * @return Spark [[Partitioner ]]
264+ */
265+ def spatialPartitioner (): Partitioner = {
266+ val bpp = boundsPerPartition().map(x => (x._1._1, x._2._1)).collect()
267+ SpatialByXPartitioner (bpp)
268+ }
269+
260270 override def count (): Long = {
261271 logInfo(" Count requested" )
262272 partitionsRDD.map(_.size).reduce(_ + _)
0 commit comments