[mb-commits] r13632 - in search_server/trunk/index/src: main/java/org/musicbrainz/search/index test/java/org/musicbrainz/search/index

[email protected] Wed, 27 Feb 2013 08:32:52 +0000
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1UAcRY-0007Ld-Ox@wiley>
Author: ijabz
Date: 2013-02-27 08:32:52 +0000 (Wed, 27 Feb 2013)
New Revision: 13632

Modified:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/ArtistCreditHelper.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/RecordingIndexTest.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseGroupIndexTest.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseIndexTest.java
Log:
#SEARCH-244:Since the October Schema Change Release, search server is now returning empty join phrases when once doesnt exist , whereas before it didn't display it all

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/ArtistCreditHelper.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/ArtistCreditHelper.java	2013-02-27 07:30:09 UTC (rev 13631)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/ArtistCreditHelper.java	2013-02-27 08:32:52 UTC (rev 13632)
@@ -106,8 +106,12 @@
             artist.setId(rs.getString(artistId));
             artist.setName(rs.getString(artistName));
             artist.setSortName(rs.getString(artistSortName));
-            artist.setDisambiguation(rs.getString(comment));
 
+            String disamb = rs.getString(comment);
+            if(disamb!=null && !disamb.isEmpty()) {
+                artist.setDisambiguation(disamb);
+            }
+
             String engAlias = rs.getString(aliasName);
             if(engAlias!=null && engAlias.length()>0)
             {
@@ -118,7 +122,10 @@
                 artist.setAliasList(al);
             }
             nc.setArtist(artist);
-            nc.setJoinphrase(rs.getString(joinPhrase));
+            String jp=rs.getString(joinPhrase);
+            if(jp!=null && !jp.isEmpty()) {
+                nc.setJoinphrase(jp);
+            }
             String nameCredit = rs.getString(artistCreditName);
             if (!nameCredit.equals(artist.getName())) {
                 nc.setName(nameCredit);

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/RecordingIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/RecordingIndexTest.java	2013-02-27 07:30:09 UTC (rev 13631)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/RecordingIndexTest.java	2013-02-27 08:32:52 UTC (rev 13632)
@@ -45,11 +45,11 @@
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (1, 'Echo & The Bunnymen')");
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (2, 'Echo and The Bunnymen')");
 
-        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name)" +
-                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2)");
+        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
+                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2,'')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -100,8 +100,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1,'')");
 
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (2, 'Pixies')");
 
@@ -146,11 +146,11 @@
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (1, 'Echo & The Bunnymen')");
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (2, 'Echo and The Bunnymen')");
 
-        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name)" +
-                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2)");
+        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
+                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2,'')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -203,11 +203,11 @@
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (1, 'Echo & The Bunnymen')");
         stmt.addBatch("INSERT INTO artist_name (id, name) VALUES (2, 'Echo and The Bunnymen')");
 
-        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name)" +
-                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2)");
+        stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
+                " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2,'')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO recording (id, gid, name, artist_credit, length)"
                 + " VALUES (1, '2f250ed2-6285-40f1-aa2a-14f1c05e9765', 1, 1, 33000)");

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseGroupIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseGroupIndexTest.java	2013-02-27 07:30:09 UTC (rev 13631)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseGroupIndexTest.java	2013-02-27 08:32:52 UTC (rev 13632)
@@ -60,8 +60,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment, begin_date_year, end_date_year, type)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2, 'a comment', 1978, 1995, 2)");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1,'')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -91,8 +91,8 @@
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_alias(id, artist, name, locale, edits_pending, last_updated) VALUES (1, 16153, 2, 'en',1,null)");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -122,8 +122,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist,name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist,name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
         
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (Bonus disc)')");
@@ -164,8 +164,8 @@
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 6, 1, 1)");
         stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase)" +
                 " VALUES (1, 0, 1, 1, ' and ')");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name)" +
-                " VALUES (1, 1, 2, 5)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase)" +
+                " VALUES (1, 1, 2, 5,'')");
         
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Epics')");
         stmt.addBatch("INSERT INTO release_group (id, gid, name, artist_credit, type)" +

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseIndexTest.java	2013-02-27 07:30:09 UTC (rev 13631)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/ReleaseIndexTest.java	2013-02-27 08:32:52 UTC (rev 13632)
@@ -45,8 +45,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 2, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -85,8 +85,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name,join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -116,8 +116,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment,)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1,'')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -149,8 +149,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1,'')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -188,8 +188,8 @@
         stmt.addBatch("INSERT INTO artist (id, gid, name, sort_name, comment)" +
                 " VALUES (16153, 'ccd4879c-5e88-4385-b131-bf65296bf245', 1, 1, 'a comment')");
         stmt.addBatch("INSERT INTO artist_credit (id, name, artist_count, ref_count) VALUES (1, 1, 1, 1)");
-        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name) " +
-                " VALUES (1, 0, 16153, 1)");
+        stmt.addBatch("INSERT INTO artist_credit_name (artist_credit, position, artist, name, join_phrase) " +
+                " VALUES (1, 0, 16153, 1, '')");
 
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (1, 'Crocodiles')");
         stmt.addBatch("INSERT INTO release_name (id, name) VALUES (2, 'Crocodiles (bonus disc)')");
@@ -266,6 +266,8 @@
             ArtistCredit ac = ArtistCreditHelper.unserialize(doc.get(ReleaseIndexField.ARTIST_CREDIT.getName()));
             assertNotNull(ac);
             assertEquals("Echo & The Bunnymen", ac.getNameCredit().get(0).getArtist().getName());
+            assertEquals(null, ac.getNameCredit().get(0).getJoinphrase());
+
         }
         ir.close();
     }