r13749 - in search_server/trunk: index/src/main/java/org/musicbrainz/search/index index/src/test/java/org/musicbrainz/search/index servlet/src/main/java/org/musicbrainz/search/servlet servlet/src/main/java/org/musicbrainz/search/servlet/mmd2 servlet/src/main/resources 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
|

r13749 - in search_server/trunk: index/src/main/java/org/musicbrainz/search/index index/src/test/java/org/musicbrainz/search/index servlet/src/main/java/org/musicbrainz/search/servlet servlet/src/main/java/org/musicbrainz/search/servlet/mmd2 servlet/src/main/resources servlet/src/test/java/org/musicbrainz/search/servlet

root-9
Author: ijabz
Date: 2014-04-28 21:37:36 +0000 (Mon, 28 Apr 2014)
New Revision: 13749

Added:
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/EditorDismaxSearch.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/EditorQueryParser.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/EditorSearch.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/EditorWriter.java
   search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindEditorTest.java
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/EditorIndexField.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/InstrumentQueryParser.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java
   search_server/trunk/servlet/src/main/resources/oxml.xml
Log:
SEARCH-265:Add editors to Indexed search

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-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndex.java 2014-04-28 21:37:36 UTC (rev 13749)
@@ -24,6 +24,7 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.search.similarities.Similarity;
+import org.musicbrainz.mmd2.Editor;
 import org.musicbrainz.mmd2.ObjectFactory;
 import org.musicbrainz.search.MbDocument;
 import org.musicbrainz.search.analysis.MusicbrainzSimilarity;
@@ -84,7 +85,7 @@
 
         addPreparedStatement("EDITORS",
                 "SELECT editor.id, editor.name as name," +
-                  "  editor.bio as description  " +
+                  "  editor.bio  " +
                 " FROM editor " +
                 " WHERE editor.id BETWEEN ? AND ?");
 
@@ -112,7 +113,7 @@
         MbDocument doc = new MbDocument();
 
         ObjectFactory of = new ObjectFactory();
-        //Editor editor = of.createEditor();
+        Editor editor = of.createEditor();
 
         int editorId = rs.getInt("id");
         doc.addField(EditorIndexField.ID, editorId);
@@ -120,17 +121,16 @@
 
         String name=rs.getString("name");
         doc.addField(EditorIndexField.EDITOR,name );
-        //editor.setName(name);
+        editor.setName(name);
 
-        String description = rs.getString("description");
-        doc.addFieldOrNoValue(EditorIndexField.DESCRIPTION, description);
-        if (!Strings.isNullOrEmpty(description)) {
-        //    editor.setDescription(description);
+        String bio = rs.getString("bio");
+        doc.addFieldOrNoValue(EditorIndexField.BIO, bio);
+        if (!Strings.isNullOrEmpty(bio)) {
+            editor.setBio(bio);
         }
 
-
-        //String store = MMDSerializer.serialize(editor);
-        //doc.addField(EditorIndexField.EDITOR_STORE, store);
+        String store = MMDSerializer.serialize(editor);
+        doc.addField(EditorIndexField.EDITOR_STORE, store);
         return doc.getLuceneDocument();
     }
 

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndexField.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndexField.java 2014-04-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/EditorIndexField.java 2014-04-28 21:37:36 UTC (rev 13749)
@@ -42,7 +42,7 @@
 
  ID            ("_id",        MusicBrainzFieldTypes.TEXT_STORED_ANALYZED_NO_NORMS, new KeywordAnalyzer()),
     EDITOR              ("editor",          MusicBrainzFieldTypes.TEXT_STORED_ANALYZED, new MusicbrainzAnalyzer()),
-    DESCRIPTION         ("description",     MusicBrainzFieldTypes.TEXT_STORED_ANALYZED, new MusicbrainzAnalyzer()),
+    BIO                 ("bio",             MusicBrainzFieldTypes.TEXT_STORED_ANALYZED, new MusicbrainzAnalyzer()),
     EDITOR_STORE        ("editorstore",     MusicBrainzFieldTypes.TEXT_STORED_NOT_INDEXED),
      ;
 

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-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/EditorIndexTest.java 2014-04-28 21:37:36 UTC (rev 13749)
@@ -1,6 +1,5 @@
 package org.musicbrainz.search.index;
 
-import org.apache.lucene.document.Document;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
@@ -63,7 +62,7 @@
         IndexReader ir = DirectoryReader.open(ramDir);
         assertEquals(2, ir.numDocs());
         {
-            checkTerm(ir, EditorIndexField.DESCRIPTION, "f");
+            checkTerm(ir, EditorIndexField.BIO, "f");
         }
         ir.close();
     }

Modified: search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/InstrumentQueryParser.java
===================================================================
--- search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/InstrumentQueryParser.java 2014-04-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/InstrumentQueryParser.java 2014-04-28 21:37:36 UTC (rev 13749)
@@ -15,35 +15,4 @@
     {
         super(LuceneVersion.LUCENE_VERSION, strings, analyzer);
     }
-
-    @Override
-    protected Query newTermQuery(Term term)
-    {
-
-        if ((term.field().equals(LabelIndexField.TYPE.getName())))
-        {
-            try
-            {
-                int typeId = Integer.parseInt(term.text());
-                if (typeId >= LabelType.getMinSearchId() && typeId <= LabelType.getMaxSearchId())
-                {
-                    TermQuery tq = new TermQuery(new Term(term.field(), LabelType.getBySearchId(typeId).getName()));
-                    return tq;
-                } else
-                {
-                    return super.newTermQuery(term);
-                }
-            }
-            catch (NumberFormatException nfe)
-            {
-                return super.newTermQuery(term);
-
-            }
-        }
-        else
-        {
-            return super.newTermQuery(term);
-
-        }
-    }
 }

Modified: search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java
===================================================================
--- search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java 2014-04-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java 2014-04-28 21:37:36 UTC (rev 13749)
@@ -22,6 +22,7 @@
   FREEDB("freedb", FreeDBIndex.class, FreeDBSearch.class, FreeDBDismaxSearch.class, false),
   ANNOTATION("annotation", AnnotationIndex.class, AnnotationSearch.class, AnnotationDismaxSearch.class, false),
   SERIES("series", SeriesIndex.class, SeriesSearch.class, SeriesDismaxSearch.class, MusicbrainzSimilarity.class, true),
+  EDITOR("editor", EditorIndex.class, EditorSearch.class, EditorDismaxSearch.class, MusicbrainzSimilarity.class, true),
   WORK("work", WorkIndex.class, WorkSearch.class, WorkDismaxSearch.class, true),
   TAG("tag", TagIndex.class, TagSearch.class, TagDismaxSearch.class, false),
   URL("url", UrlIndex.class, UrlSearch.class, UrlDismaxSearch.class, false),

Modified: search_server/trunk/servlet/src/main/resources/oxml.xml
===================================================================
--- search_server/trunk/servlet/src/main/resources/oxml.xml 2014-04-28 21:03:18 UTC (rev 13748)
+++ search_server/trunk/servlet/src/main/resources/oxml.xml 2014-04-28 21:37:36 UTC (rev 13749)
@@ -10,6 +10,16 @@
         </java-type>
         <java-type name="Metadata">
             <java-attributes>
+                <xml-element java-attribute="seriesList" xml-path="."/>
+            </java-attributes>
+        </java-type>
+        <java-type name="Metadata">
+            <java-attributes>
+                <xml-element java-attribute="editorList" xml-path="."/>
+            </java-attributes>
+        </java-type>
+        <java-type name="Metadata">
+            <java-attributes>
                 <xml-element java-attribute="placeList" xml-path="."/>
             </java-attributes>
         </java-type>
@@ -153,6 +163,11 @@
                 <xml-element java-attribute="aliasList" xml-path="."/>
             </java-attributes>
         </java-type>
+        <java-type name="Series">
+            <java-attributes>
+                <xml-element java-attribute="aliasList" xml-path="."/>
+            </java-attributes>
+        </java-type>
         <java-type name="Work">
             <java-attributes>
                 <xml-element java-attribute="iswcList" xml-path="."/>
@@ -228,6 +243,11 @@
                 <xml-element java-attribute="instrument" name="instruments"/>
             </java-attributes>
         </java-type>
+        <java-type name="EditorList">
+            <java-attributes>
+                <xml-element java-attribute="editor" name="editors"/>
+            </java-attributes>
+        </java-type>
         <java-type name="ReleaseList">
             <java-attributes>
                 <xml-element java-attribute="release" name="releases"/>


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