Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Tests for Term filter queries.

  • Loading branch information...
commit 7a6eeaec0023a8d9356723c69ea0859d57410b09 1 parent 75d6c4f
Adam Alix authored May 10, 2012
24  src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
@@ -347,18 +347,18 @@ class ElasticQueryTest extends SpecsMatchers with ScalaCheckMatchers {
347 347
   }
348 348
 
349 349
   @Test
350  
-  def testUnanalyzed {
351  
-    try {
352  
-      val res1 = ESimplePanda where (_.termsfield eqs "termhit") fetch()
353  
-      val res2 = ESimplePanda where (_.termsfield in List("randomterm", "termhit")) fetch()
354  
-      Assert.assertEquals(res1.response.results.length, 1)
355  
-      Assert.assertEquals(res2.response.results.length, 1)
356  
-    } catch {
357  
-      case e: Exception => {
358  
-        e.printStackTrace()
359  
-        Assert.fail
360  
-      }
361  
-    }
  350
+  def testTermQueries {
  351
+    val res1 = ESimplePanda where (_.termsfield eqs "termhit") fetch()
  352
+    val res2 = ESimplePanda where (_.termsfield in List("randomterm", "termhit")) fetch()
  353
+    Assert.assertEquals(res1.response.results.length, 1)
  354
+    Assert.assertEquals(res2.response.results.length, 1)
  355
+  }
  356
+
  357
+  @Test
  358
+  def testTermFilters {
  359
+    // grab 2 results, filter to 1
  360
+    val res1 = ESimplePanda where (_.hugenums contains 1L) filter(_.termsfield in List("termhit", "randomterm")) fetch()
  361
+    Assert.assertEquals(res1.response.results.length, 1)
362 362
   }
363 363
 
364 364
   @Before

0 notes on commit 7a6eeae

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