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

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

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

root-9
Author: ijabz
Date: 2014-04-28 14:18:26 +0000 (Mon, 28 Apr 2014)
New Revision: 13746

Modified:
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/WorkDismaxSearch.java
   search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindWorkTest.java
Log:
SEARCH-352:Include disambiguation in work index

Modified: search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/WorkDismaxSearch.java
===================================================================
--- search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/WorkDismaxSearch.java 2014-04-28 14:07:55 UTC (rev 13745)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/WorkDismaxSearch.java 2014-04-28 14:18:26 UTC (rev 13746)
@@ -32,6 +32,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.musicbrainz.search.index.LabelIndexField;
 import org.musicbrainz.search.index.WorkIndexField;
 
 public class WorkDismaxSearch extends AbstractDismaxSearchServer {
@@ -39,8 +40,9 @@
   @Override
   protected DismaxSearcher initDismaxSearcher() {
     Map<String, DismaxAlias.AliasField> fieldBoosts = new HashMap<String, DismaxAlias.AliasField>(2);
-    fieldBoosts.put(WorkIndexField.WORK.getName(), new DismaxAlias.AliasField(true, 1.3f));
-    fieldBoosts.put(WorkIndexField.ALIAS.getName(), new DismaxAlias.AliasField(true, 0.9f));
+    fieldBoosts.put(WorkIndexField.WORK.getName(),      new DismaxAlias.AliasField(true, 1.3f));
+    fieldBoosts.put(WorkIndexField.ALIAS.getName(),     new DismaxAlias.AliasField(true, 0.9f));
+    fieldBoosts.put(WorkIndexField.COMMENT.getName(),   new DismaxAlias.AliasField(true, 0.7f));
     DismaxAlias dismaxAlias = new DismaxAlias();
     dismaxAlias.setFields(fieldBoosts);
     dismaxAlias.setTie(0.1f);

Modified: search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindWorkTest.java
===================================================================
--- search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindWorkTest.java 2014-04-28 14:07:55 UTC (rev 13745)
+++ search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindWorkTest.java 2014-04-28 14:18:26 UTC (rev 13746)
@@ -239,6 +239,15 @@
     }
 
     @Test
+    public void testFindWorkByDismax3() throws Exception {
+        Results res = sd.search("demo", 0, 10);
+        assertEquals(1, res.getTotalHits());
+        Result result = res.results.get(0);
+        MbDocument doc = result.getDoc();
+        assertEquals("4ff89cf0-86af-11de-90ed-001fc6f176ff", doc.get(WorkIndexField.WORK_ID));
+        assertEquals("Symphony No. 5", doc.get(WorkIndexField.WORK));
+    }
+    @Test
     public void testFindWorkByComment() throws Exception {
         Results res = ss.search("comment:demo", 0, 10);
         assertEquals(1, res.getTotalHits());


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