r13743 - 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
|  
Report Content as Inappropriate

r13743 - 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 11:04:49 +0000 (Mon, 28 Apr 2014)
New Revision: 13743

Added:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/InstrumentIndex.java
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/InstrumentIndexField.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/InstrumentIndexTest.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/InstrumentDismaxSearch.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/InstrumentSearch.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/InstrumentWriter.java
   search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindInstrumentTest.java
Modified:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexBuilder.java
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexOptions.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/AbstractIndexTest.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-338:Basic support for instrument entities

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexBuilder.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexBuilder.java 2014-04-25 14:02:01 UTC (rev 13742)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexBuilder.java 2014-04-28 11:04:49 UTC (rev 13743)
@@ -124,6 +124,7 @@
                 new PlaceIndex(mainDbConn),
                 new AnnotationIndex(mainDbConn),
                 new UrlIndex(mainDbConn),
+                new InstrumentIndex(mainDbConn),
                 new TagIndex(mainDbConn),
                 new CDStubIndex(mainDbConn), //Note different db
         };

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexOptions.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexOptions.java 2014-04-25 14:02:01 UTC (rev 13742)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/IndexOptions.java 2014-04-28 11:04:49 UTC (rev 13743)
@@ -68,8 +68,8 @@
     public String getFreeDBDump() { return freeDBDump; }
 
     // Selection of indexes to build
-    @Option(name="--indexes", usage="A comma-separated list of indexes to build (annotation,area,artist,place,releasegroup,release,recording,label,work,tag,url,cdstub,freedb)")
-    private String indexes = "annotation,area,artist,label,place,release,recording,releasegroup,work,tag,url,cdstub,freedb";
+    @Option(name="--indexes", usage="A comma-separated list of indexes to build (annotation,area,artist,instrument,label,place,releasegroup,release,recording,work,tag,url,cdstub,freedb)")
+    private String indexes = "annotation,area,artist,instrument,label,place,release,recording,releasegroup,work,tag,url,cdstub,freedb";
     public ArrayList<String> selectedIndexes() { return new ArrayList<String>(Arrays.asList(indexes.split(","))); }
     public boolean buildIndex(String indexName) { return selectedIndexes().contains(indexName); }
 

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/AbstractIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/AbstractIndexTest.java 2014-04-25 14:02:01 UTC (rev 13742)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/AbstractIndexTest.java 2014-04-28 11:04:49 UTC (rev 13743)
@@ -221,6 +221,11 @@
                 stmt.addBatch("DROP TABLE l_place_work");
                 stmt.addBatch("DROP TABLE l_place_tag");
 
+                stmt.addBatch("DROP TABLE instrument_type");
+                stmt.addBatch("DROP TABLE instrument");
+                stmt.addBatch("DROP TABLE instrument_alias_type");
+                stmt.addBatch("DROP TABLE instrument_alias");
+
                 stmt.addBatch("DROP TABLE replication_control");
                 stmt.addBatch("DROP TABLE dbmirror_pending");
                 stmt.addBatch("DROP TABLE dbmirror_pendingdata");
@@ -250,6 +255,7 @@
             setupWorkTables(stmt);
             setupPlaceTables(stmt);
             setupUrlTables(stmt);
+            setupInstrumentTables(stmt);
             setupReplicationTables(stmt);
             
             insertReferenceData(stmt);
@@ -1075,7 +1081,56 @@
 
     }
 
+    protected void setupInstrumentTables(Statement stmt) throws Exception {
+        stmt.addBatch("CREATE TABLE instrument_type (\n" +
+                "    id                  SERIAL, -- PK\n" +
+                "    name                VARCHAR(255) NOT NULL,\n" +
+                "    parent              INTEGER, \n" +
+                "    child_order         INTEGER NOT NULL DEFAULT 0,\n" +
+                "    description         TEXT\n" +
+                ");");
 
+        stmt.addBatch("CREATE TABLE instrument (\n" +
+                "    id                  SERIAL, -- PK\n" +
+                "    gid                 uuid NOT NULL,\n" +
+                "    name                VARCHAR NOT NULL,\n" +
+                "    type                INTEGER, -- references instrument_type.id\n" +
+                "    edits_pending       INTEGER NOT NULL DEFAULT 0 ,\n" +
+                "    last_updated        TIMESTAMP ,\n" +
+                "    comment             VARCHAR(255) NOT NULL DEFAULT '',\n" +
+                "    description         TEXT NOT NULL DEFAULT ''\n" +
+                ");");
+
+
+        stmt.addBatch("CREATE TABLE instrument_alias_type (\n" +
+                "    id SERIAL, -- PK,\n" +
+                "    name TEXT NOT NULL,\n" +
+                "    parent              INTEGER, \n" +
+                "    child_order         INTEGER NOT NULL DEFAULT 0,\n" +
+                "    description         TEXT\n" +
+                ");");
+
+        stmt.addBatch("CREATE TABLE instrument_alias (\n" +
+                "    id                  SERIAL, \n" +
+                "    instrument          INTEGER NOT NULL, \n" +
+                "    name                VARCHAR NOT NULL,\n" +
+                "    locale              TEXT,\n" +
+                "    edits_pending       INTEGER ,\n" +
+                "    last_updated        TIMESTAMP  ,\n" +
+                "    type                INTEGER, \n" +
+                "    sort_name           VARCHAR ,\n" +
+                "    begin_date_year     SMALLINT,\n" +
+                "    begin_date_month    SMALLINT,\n" +
+                "    begin_date_day      SMALLINT,\n" +
+                "    end_date_year       SMALLINT,\n" +
+                "    end_date_month      SMALLINT,\n" +
+                "    end_date_day        SMALLINT,\n" +
+                "    primary_for_locale  BOOLEAN,\n" +
+                "    ended               BOOLEAN  \n" +
+                ");");
+
+    }
+
     protected void setupUrlTables(Statement stmt) throws Exception {
 
         stmt.addBatch("CREATE TABLE url" +

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-25 14:02:01 UTC (rev 13742)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java 2014-04-28 11:04:49 UTC (rev 13743)
@@ -12,6 +12,7 @@
 public enum ResourceType {
   AREA("area", AreaIndex.class, AreaSearch.class, AreaDismaxSearch.class, MusicbrainzSimilarity.class, false),
   ARTIST("artist", ArtistIndex.class, ArtistSearch.class, ArtistDismaxSearch.class, MusicbrainzSimilarity.class, true),
+  INSTRUMENT("instrument", InstrumentIndex.class, InstrumentSearch.class, InstrumentDismaxSearch.class, MusicbrainzSimilarity.class, true),
   LABEL("label", LabelIndex.class, LabelSearch.class, LabelDismaxSearch.class, MusicbrainzSimilarity.class, true),
   PLACE("place", PlaceIndex.class, PlaceSearch.class, PlaceDismaxSearch.class, MusicbrainzSimilarity.class, false),
   RELEASE("release", ReleaseIndex.class, ReleaseSearch.class, ReleaseDismaxSearch.class, true),

Modified: search_server/trunk/servlet/src/main/resources/oxml.xml
===================================================================
--- search_server/trunk/servlet/src/main/resources/oxml.xml 2014-04-25 14:02:01 UTC (rev 13742)
+++ search_server/trunk/servlet/src/main/resources/oxml.xml 2014-04-28 11:04:49 UTC (rev 13743)
@@ -5,6 +5,11 @@
     <java-types>
         <java-type name="Metadata">
             <java-attributes>
+                <xml-element java-attribute="instrumentList" xml-path="."/>
+            </java-attributes>
+        </java-type>
+        <java-type name="Metadata">
+            <java-attributes>
                 <xml-element java-attribute="placeList" xml-path="."/>
             </java-attributes>
         </java-type>
@@ -218,6 +223,11 @@
                 <xml-element java-attribute="place" name="places"/>
             </java-attributes>
         </java-type>
+        <java-type name="InstrumentList">
+            <java-attributes>
+                <xml-element java-attribute="instrument" name="instruments"/>
+            </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
Loading...