Permalink
Browse files

Changed SlashemGeoField to be unanalyzed:

- SlashemGeoField now extends SlashemUnanalyzedStringField
- Fixed extend() for Term[T] queries because of failing unit tests
  • Loading branch information...
1 parent 77e3ab9 commit 8978eaf059bb1b06303ef0b4fd88d5e516bbd400 @adamalix adamalix committed May 10, 2012
@@ -420,7 +420,8 @@ object Ast {
//def extend() = throw new UnimplementedException("Slashem does not support Term queries Solr")
def extend(): String = {
escaped match {
- case true => {'"' + escape(query.toString) + '"'}
+ // hack to fix wrapping the queries in a List()
+ case true => {'"' + escape(query.mkString("")) + '"'}
case false => '"' + query.toString + '"'
}
}
@@ -793,7 +793,6 @@ trait SolrSchema[M <: Record[M]] extends SlashemSchema[M] {
*/
trait SlashemUnanalyzedField[V, M <: Record[M]] extends SlashemField[V, M] {
self: Field[V, M] =>
- import Helpers._
override val unanalyzed = true
}
@@ -802,6 +801,7 @@ trait SlashemField[V, M <: Record[M]] extends OwnedField[M] {
self: Field[V, M] =>
import Helpers._
+ // Override this value to produce unanalyzed queries!
val unanalyzed = false
def produceQuery(v: V): Query[V] = {
@@ -991,7 +991,7 @@ class SlashemPointField[T <: Record[T]](owner: T) extends PointField[T](owner) w
class SlashemBooleanField[T <: Record[T]](owner: T) extends BooleanField[T](owner) with SlashemField[Boolean, T]
class SlashemDateTimeField[T <: Record[T]](owner: T) extends JodaDateTimeField[T](owner) with SlashemField[DateTime, T]
//More restrictive type so we can access the geohash
-class SlashemGeoField[T <: SlashemSchema[T]](owner: T) extends SlashemStringField[T](owner) {
+class SlashemGeoField[T <: SlashemSchema[T]](owner: T) extends SlashemUnanalyzedStringField[T](owner) {
def inRadius(geoLat: Double, geoLong: Double, radiusInMeters: Int, maxCells: Int = owner.geohash.maxCells) = {
val cellIds = owner.geohash.coverString(geoLat, geoLong, radiusInMeters, maxCells = maxCells)
//If we have an empty cover we default to everything.

0 comments on commit 8978eaf

Please sign in to comment.