Browse files

Fix query gen for elasitcboost weights of 1.0

  • Loading branch information...
1 parent c9dd050 commit 5e9d1331508cabd7146fd6a1e7ffd4971a3e836f @holdenk holdenk committed with adamalix May 7, 2012
View
2 build.sbt
@@ -1,6 +1,6 @@
name := "slashem"
-version := "0.9.14"
+version := "0.9.15"
organization := "com.foursquare"
View
2 src/main/scala/com/foursquare/slashem/Ast.scala
@@ -243,7 +243,7 @@ object Ast {
}
def elasticBoost(): Pair[List[String],String] = {
weight match {
- case 1.0 => Pair(Nil,"(doc['" + fieldName + "'].value)")
+ case 1.0 => Pair(Nil,"doc['" + fieldName + "'].value")
case _ => Pair(Nil,"(doc['" + fieldName + "'].value *" + weight.toString + ")")
}
}
View
8 src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
@@ -79,6 +79,14 @@ class ElasticQueryTest extends SpecsMatchers with ScalaCheckMatchers {
}
@Test
+ def simpleBoostTest {
+ val fullQuery = ESimplePanda.where(_.name contains "lol")
+ .limit(5).boostField(_.followers)
+ val r = fullQuery fetch()
+ }
+
+
+ @Test
def testEmptySearch {
try {
val r = ESimplePanda where (_.name eqs "lolsdonotinsertsomethingwiththisinit") fetch()

0 comments on commit 5e9d133

Please sign in to comment.