r13735 - in search_server/trunk: index/src/main/java/org/musicbrainz/search/index index/src/test/java/org/musicbrainz/search/index servlet/src/test/java/org/musicbrainz/search/servlet

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

r13735 - in search_server/trunk: index/src/main/java/org/musicbrainz/search/index index/src/test/java/org/musicbrainz/search/index servlet/src/test/java/org/musicbrainz/search/servlet

root-9
Author: ijabz
Date: 2014-04-25 10:32:18 +0000 (Fri, 25 Apr 2014)
New Revision: 13735

Modified:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java
   search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindUrlTest.java
Log:
SEARCH-332:target element for relationships included in /ws/2/url endpoint is improperly structured to match lookup

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java 2014-04-24 13:30:30 UTC (rev 13734)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java 2014-04-25 10:32:18 UTC (rev 13735)
@@ -131,7 +131,7 @@
         doc.addField(UrlIndexField.RELATION_TYPE,relationType);
 
         Target target = of.createTarget();
-        target.setId(artistId);
+        target.setValue(artistId);
         doc.addField(UrlIndexField.TARGET_ID, artistId);
         relation.setTarget(target);
 

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java 2014-04-24 13:30:30 UTC (rev 13734)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java 2014-04-25 10:32:18 UTC (rev 13735)
@@ -124,7 +124,7 @@
             assertEquals("artist", url.getRelationList().get(0).getTargetType());
             Relation relation = url.getRelationList().get(0).getRelation().get(0);
             assertEquals("Wikipedia", relation.getType());
-            assertEquals("4302e264-1cf0-4d1f-aca7-2a6f89e34b36", relation.getTarget().getId());
+            assertEquals("4302e264-1cf0-4d1f-aca7-2a6f89e34b36", relation.getTarget().getValue());
             assertEquals("4302e264-1cf0-4d1f-aca7-2a6f89e34b36", relation.getArtist().getId());
             assertEquals("Nine Inch Nails", relation.getArtist().getName());
             assertEquals("Nails, Nine Inch", relation.getArtist().getSortName());

Modified: search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindUrlTest.java
===================================================================
--- search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindUrlTest.java 2014-04-24 13:30:30 UTC (rev 13734)
+++ search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindUrlTest.java 2014-04-25 10:32:18 UTC (rev 13735)
@@ -53,6 +53,9 @@
             doc.addField(UrlIndexField.RELATION_TYPE, "Wikipedia");
             {
                 Relation relation = of.createRelation();
+                Target   target   = of.createTarget();
+                target.setValue("4302e264-1cf0-4d1f-aca7-2a6f89e34b36");
+                relation.setTarget(target);
                 Artist artist1 = of.createArtist();
                 artist1.setId("4302e264-1cf0-4d1f-aca7-2a6f89e34b36");
                 artist1.setName("Nine Inch Nails");
@@ -117,6 +120,15 @@
     }
 
     @Test
+    public void testFindUrlByTargetTypeUppercase() throws Exception {
+        Results res = ss.search("targettype:ARTIST", 0, 10);
+        assertEquals(1, res.getTotalHits());
+        Result result = res.results.get(0);
+        MbDocument doc = result.getDoc();
+        assertEquals("4ff89cf0-86af-11de-90ed-001fc6f176ff", doc.get(UrlIndexField.URL_ID));
+        assertEquals("http://en.wikipedia.org/wiki/Nine_Inch_Nails", doc.get(UrlIndexField.URL));
+    }
+    @Test
     public void testFindUrlByRelationType() throws Exception {
         Results res = ss.search("relationtype:wikipedia", 0, 10);
         assertEquals(1, res.getTotalHits());
@@ -148,7 +160,7 @@
         assertTrue(output.contains("<resource>http://en.wikipedia.org/wiki/Nine_Inch_Nails</resource>"));
         assertTrue(output.contains("<relation-list target-type=\"artist\">"));
         assertTrue(output.contains("<relation type=\"Wikipedia\">"));
-
+        assertTrue(output.contains("<target>4302e264-1cf0-4d1f-aca7-2a6f89e34b36</target>"));
     }
 
     /**


_______________________________________________
MusicBrainz-commits mailing list
[hidden email]
http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-commits