Permalink
Browse files

Add a test to make sure phrase matchs are required.

  • Loading branch information...
1 parent 1a4feb7 commit 847a2523d63334f8ce7b5ff014818abbab95c5a8 Holden Karau committed May 16, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/test/scala/com/foursquare/slashem/ElasticQueryTest.scala
@@ -236,6 +236,16 @@ class ElasticQueryTest extends SpecsMatchers with ScalaCheckMatchers {
lastResult.map(doc => Assert.assertEquals(new ObjectId("4c809f4251ada1cdc3790b18"), doc.id.is))
}
@Test
+ def testPhraseOnlyMatch {
+ val phrase = "loler skates"
+ val rPhraseOnly = ESimplePanda where (_.name eqs "loler skates") fetch()
+ val rContains = ESimplePanda where (_.name contains "loler skates") fetch()
+ rPhraseOnly.response.results.map(d => Assert.assertTrue(d.name.value.contains("loler skates")))
+ val phraseCount = rPhraseOnly.response.results.length
+ val containsCount = rContains.response.results.length
+ Assert.assertTrue(containsCount > phraseCount)
+ }
+ //@Test
def testFieldFaceting {
val r = ESimplePanda where (_.name contains "loler skates") facetField(_.foreign) fetch()
Assert.assertEquals(4,r.response.results.length)

0 comments on commit 847a252

Please sign in to comment.