esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From esjew...@apache.org
Subject svn commit: r959564 - in /incubator/esme/trunk/server/src: main/scala/org/apache/esme/api/API2.scala main/scala/org/apache/esme/model/Message.scala test/scala/org/apache/esme/api/API2Test.scala
Date Thu, 01 Jul 2010 09:17:00 GMT
Author: esjewett
Date: Thu Jul  1 09:16:59 2010
New Revision: 959564

URL: http://svn.apache.org/viewvc?rev=959564&view=rev
Log:
Fixes API2 test failure - issue was that the API search was suffering from the same case-sensitivity
around tags as the web-based searched was having - I moved both the index and the search query
generation to lower-case, so that should solve the issue.

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/API2.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
    incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/API2Test.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/API2.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/API2.scala?rev=959564&r1=959563&r2=959564&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/API2.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/api/API2.scala Thu Jul  1 09:16:59
2010
@@ -612,8 +612,8 @@ object API2 extends ApiHelper with XmlHe
             val tagQuery = queryBuilder.bool()
 
             for(tags <- S.param("filter_tags");
-                tag <- tags.split(",")) {
-              tagQuery.addMust(queryBuilder.term("tags", tag.split(" ").mkString("_")))
+                tag <- tags.split(",")) {  
+              tagQuery.addMust(queryBuilder.term("tags", tag.split(" ").mkString("_").toLowerCase()))
             }
 
             val non_tag_query = queryBuilder.bool()
@@ -621,7 +621,7 @@ object API2 extends ApiHelper with XmlHe
 
 
             val query = if(S.param("filter_tags").isDefined)
-              non_tag_query.addMust(tagQuery.toQuery).toQuery()
+              non_tag_query.addMust(tagQuery.toQuery()).toQuery()
             else
               non_tag_query.toQuery()
 

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala?rev=959564&r1=959563&r2=959564&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/model/Message.scala Thu Jul
 1 09:16:59 2010
@@ -481,7 +481,7 @@ class Message extends LongKeyedMapper[Me
   @SearchableProperty{val termVector=TermVector.YES, val analyzer="default"}
   def getTags:String = {
     // Create a string of space-separated tags, with the spaces in each tag converted to
underscores 
-    val tagString: String = tags.map(x => x.split(" ").mkString("_")) mkString " "
+    val tagString: String = tags.map(x => x.split(" ").mkString("_")).mkString(" ").toLowerCase()
 
     tagString
   } 
 

Modified: incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/API2Test.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/API2Test.scala?rev=959564&r1=959563&r2=959564&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/API2Test.scala (original)
+++ incubator/esme/trunk/server/src/test/scala/org/apache/esme/api/API2Test.scala Thu Jul
 1 09:16:59 2010
@@ -572,7 +572,7 @@ object Api2Specs extends Specification w
                                 "replyto" -> 9)
           wait2 <- sleep(1000)
           res <- sess.get("conversations/9")
-        } {
+        } {                     
           res.code must be equalTo 200
           ( res.xml.open_! \\ "message" ).last must \\(<conversation>9</conversation>)
           ( res.xml.open_! \\ "message" ).last must \\(<replyto>9</replyto>)
@@ -675,7 +675,7 @@ object Api2Specs extends Specification w
             "pool" -> "test_pool4")
           timeout <- sleep(2000)
           mess_res <- sess.get("pools/4/messages")
-        } {
+        } {                     
           mess_res.code must be equalTo 200
 
           // Message structure
@@ -738,14 +738,14 @@ object Api2Specs extends Specification w
             "pool" -> "test_pool6",
             "tags" -> "tag")
           wait <- sleep(2000)
-          res1 <- sess.get("pools/6/messages?history=10&filter_tags=test")
+          res1 <- sess.get("pools/6/messages?history=10&filter_tags=test")      
           res2 <- sess.get("pools/6/messages?history=10&filter_tags=test,tag")
-        } {
-          res1.code must be equalTo 200
-          res2.code must be equalTo 200
+        } {                               
+          res1.code must be equalTo 200   
+          res2.code must be equalTo 200       
           (res1.xml.open_! \ "messages") must \\(<id>{theUser.id.toString}</id>)
           (res1.xml.open_! \ "messages") must \\(<body>test message for pool history
with tag test</body>)
-          (res1.xml.open_! \ "messages") must \\(<body>test message for pool history
with tags test, tag</body>)
+          (res1.xml.open_! \ "messages") must \\(<body>test message for pool history
with tags test, tag</body>) 
           (res2.xml.open_! \ "messages") must \\(<body>test message for pool history
with tags test, tag</body>)
           (res2.xml.open_! \ "messages").length must be equalTo 1
         }



Mime
View raw message