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

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

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

root-9
Author: ijabz
Date: 2014-04-29 10:53:15 +0000 (Tue, 29 Apr 2014)
New Revision: 13751

Modified:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndex.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java
Log:
SEARCH-265:Ignore bio if email not confirmed

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndex.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndex.java 2014-04-29 08:57:46 UTC (rev 13750)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndex.java 2014-04-29 10:53:15 UTC (rev 13751)
@@ -87,7 +87,8 @@
                 "SELECT editor.id, editor.name as name," +
                   "  editor.bio  " +
                 " FROM editor " +
-                " WHERE editor.id BETWEEN ? AND ?");
+                " WHERE editor.id BETWEEN ? AND ?" +
+                " AND email_confirm_date is not NULL");
 
 
     }

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java 2014-04-29 08:57:46 UTC (rev 13750)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java 2014-04-29 10:53:15 UTC (rev 13751)
@@ -30,12 +30,21 @@
     private void addEditorOne() throws Exception {
 
         Statement stmt = conn.createStatement();
-        stmt.addBatch("INSERT INTO editor (id, name, bio) VALUES (1,'frankf','frank the f')");
+        stmt.addBatch("INSERT INTO editor (id, name, bio, email_confirm_date) VALUES (1,'frankf','frank the f', '2012-09-17 18:47:52.69')");
 
         stmt.executeBatch();
         stmt.close();
     }
 
+    private void addEditorTwo() throws Exception {
+
+        Statement stmt = conn.createStatement();
+        stmt.addBatch("INSERT INTO editor (id, name, bio) VALUES (1,'jane','janet')");
+
+        stmt.executeBatch();
+        stmt.close();
+    }
+
     @Test
     public void testIndexEditorName() throws Exception {
 
@@ -53,7 +62,7 @@
     }
 
     @Test
-    public void testIndexEditorDescription() throws Exception {
+    public void testIndexEditorBio() throws Exception {
 
         addEditorOne();
         RAMDirectory ramDir = new RAMDirectory();
@@ -66,4 +75,16 @@
         }
         ir.close();
     }
+
+    @Test
+    public void testIndexEditorIgnoreBioIfNotConfirmed() throws Exception {
+
+        addEditorTwo();
+        RAMDirectory ramDir = new RAMDirectory();
+        createIndex(ramDir);
+
+        IndexReader ir = DirectoryReader.open(ramDir);
+        assertEquals(1, ir.numDocs());
+        ir.close();
+    }
 }
\ No newline at end of file


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