Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix intlist serilization

  • Loading branch information...
commit 263f98f0d6396fdc8b9f95aab5e196e2e738563f 1 parent 203e994
Holden Karau holdenk authored
2  build.sbt
... ... @@ -1,6 +1,6 @@
1 1 name := "slashem"
2 2
3   -version := "0.12.4"
  3 +version := "0.12.5"
4 4
5 5 organization := "com.foursquare"
6 6
4 src/main/scala/com/foursquare/slashem/Schema.scala
@@ -992,7 +992,7 @@ class SlashemIntListField[T <: Record[T]](owner: T) extends IntListField[T](owne
992 992 case "" => Empty
993 993 case ar: Array[Int] => Full(ar.toList)
994 994 case ar: Array[Integer] => Full(ar.toList.map(x=>x.intValue))
995   - case ar: ArrayList[_] => Full(set(ar.toArray.asInstanceOf[Array[Int]].toList))
  995 + case ar: ArrayList[_] => Full(set(ar.toArray.toList.map(x=>x.asInstanceOf[Integer].intValue)))
996 996 case s: String => Full(s.split(" ").map(x => x.toInt).toList)
997 997 case _ => Empty
998 998 }
@@ -1227,7 +1227,7 @@ class IntListField[T <: Record[T]](override val owner: T) extends Field[List[Int
1227 1227 case "" => Empty
1228 1228 case ar: Array[Int] => Full(set(ar.toList))
1229 1229 case ar: Array[Integer] => Full(set(ar.toList.map(x=>x.intValue)))
1230   - case ar: ArrayList[_] => Full(set(ar.toArray.asInstanceOf[Array[Int]].toList))
  1230 + case ar: ArrayList[_] => Full(set(ar.toArray.toList.map(x=>x.asInstanceOf[Integer].intValue)))
1231 1231 case s: String => Full(set(s.split(" ").map(x => x.toInt).toList))
1232 1232 case _ => Empty
1233 1233 }
7 src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
@@ -354,6 +354,13 @@ class ElasticQueryTest extends SpecsMatchers with ScalaCheckMatchers {
354 354 }
355 355
356 356 @Test
  357 + def testIntListFieldReturn {
  358 + val response1 = ESimplePanda where (_.favnums contains 2) fetch()
  359 + Assert.assertEquals(response1.response.results.length, 2)
  360 + Assert.assertEquals(response1.response.results.head.favnums.get, List(1,2,3,4,5))
  361 + }
  362 +
  363 + @Test
357 364 def testListFieldIn {
358 365 val response1 = ESimplePanda where (_.favnums in List(2, 3, 4, 5)) fetch()
359 366 val response2 = ESimplePanda where (_.favnums in List(99)) fetch()

0 comments on commit 263f98f

Please sign in to comment.
Something went wrong with that request. Please try again.