r13728 - 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

r13728 - 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: 2013-10-09 19:54:27 +0000 (Wed, 09 Oct 2013)
New Revision: 13728

Added:
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/UrlDismaxSearch.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/UrlQueryParser.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/UrlSearch.java
   search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/UrlWriter.java
   search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindUrlTest.java
Modified:
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java
   search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndexField.java
   search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.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-149:Aadded searchng for Artist URL Realations

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java 2013-10-04 10:23:58 UTC (rev 13727)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndex.java 2013-10-09 19:54:27 UTC (rev 13728)
@@ -123,9 +123,12 @@
         artist.setId(artistId);
         artist.setName(rs.getString("artist_name"));
         artist.setSortName(rs.getString("artist_sortname"));
+
         Relation relation = of.createRelation();
         relation.setArtist(artist);
-        relation.setType(rs.getString("link"));
+        String relationType = rs.getString("link");
+        relation.setType(relationType);
+        doc.addField(UrlIndexField.RELATION_TYPE,relationType);
 
         Target target = of.createTarget();
         target.setId(artistId);

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndexField.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndexField.java 2013-10-04 10:23:58 UTC (rev 13727)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/UrlIndexField.java 2013-10-09 19:54:27 UTC (rev 13728)
@@ -40,12 +40,13 @@
  */
 public enum UrlIndexField implements IndexField {
 
- ID    ("_id",    MusicBrainzFieldTypes.TEXT_STORED_ANALYZED_NO_NORMS, new KeywordAnalyzer()),
-    URL_ID      ("uid",    MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS, new KeywordAnalyzer()),
-    URL         ("url",         MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS,  new KeywordAnalyzer()),
-    TARGET_ID   ("targetid",    MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS,  new KeywordAnalyzer()),
-    TARGET_TYPE ("targettype",  MusicBrainzFieldTypes.TEXT_STORED_ANALYZED,  new MusicbrainzAnalyzer()),
-    URL_STORE   ("urlstore",    MusicBrainzFieldTypes.TEXT_STORED_NOT_INDEXED),
+ ID        ("_id",        MusicBrainzFieldTypes.TEXT_STORED_ANALYZED_NO_NORMS, new KeywordAnalyzer()),
+    URL_ID          ("uid",        MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS, new KeywordAnalyzer()),
+    URL             ("url",             MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS,  new KeywordAnalyzer()),
+    RELATION_TYPE   ("relationtype",    MusicBrainzFieldTypes.TEXT_STORED_ANALYZED,  new MusicbrainzAnalyzer()),
+    TARGET_ID       ("targetid",        MusicBrainzFieldTypes.TEXT_STORED_NOT_ANALYZED_NO_NORMS,  new KeywordAnalyzer()),
+    TARGET_TYPE     ("targettype",      MusicBrainzFieldTypes.TEXT_STORED_ANALYZED,  new MusicbrainzAnalyzer()),
+    URL_STORE       ("urlstore",        MusicBrainzFieldTypes.TEXT_STORED_NOT_INDEXED),
     ;
 
     private String name;

Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java 2013-10-04 10:23:58 UTC (rev 13727)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/UrlIndexTest.java 2013-10-09 19:54:27 UTC (rev 13728)
@@ -76,6 +76,38 @@
     }
 
     @Test
+    public void testIndexUrlTargetType() throws Exception {
+
+        addUrlOne();
+        RAMDirectory ramDir = new RAMDirectory();
+        createIndex(ramDir);
+
+        IndexReader ir = DirectoryReader.open(ramDir);
+        assertEquals(2, ir.numDocs());
+        {
+            checkTerm(ir, UrlIndexField.TARGET_TYPE, "artist");
+
+        }
+        ir.close();
+    }
+
+    @Test
+    public void testIndexUrlRelationType() throws Exception {
+
+        addUrlOne();
+        RAMDirectory ramDir = new RAMDirectory();
+        createIndex(ramDir);
+
+        IndexReader ir = DirectoryReader.open(ramDir);
+        assertEquals(2, ir.numDocs());
+        {
+            checkTerm(ir, UrlIndexField.RELATION_TYPE, "wikipedia");
+
+        }
+        ir.close();
+    }
+
+    @Test
     public void testIndexUrlStore() throws Exception {
 
         addUrlOne();

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 2013-10-04 10:23:58 UTC (rev 13727)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java 2013-10-09 19:54:27 UTC (rev 13728)
@@ -21,7 +21,9 @@
   FREEDB("freedb", FreeDBIndex.class, FreeDBSearch.class, FreeDBDismaxSearch.class, false),
   ANNOTATION("annotation", AnnotationIndex.class, AnnotationSearch.class, AnnotationDismaxSearch.class, false),
   WORK("work", WorkIndex.class, WorkSearch.class, WorkDismaxSearch.class, true),
-  TAG("tag", TagIndex.class, TagSearch.class, TagDismaxSearch.class, false), ;
+  TAG("tag", TagIndex.class, TagSearch.class, TagDismaxSearch.class, false),
+  URL("url", UrlIndex.class, UrlSearch.class, UrlDismaxSearch.class, false),
+  ;
 
   private String name;
   private String indexName = null;

Modified: search_server/trunk/servlet/src/main/resources/oxml.xml
===================================================================
--- search_server/trunk/servlet/src/main/resources/oxml.xml 2013-10-04 10:23:58 UTC (rev 13727)
+++ search_server/trunk/servlet/src/main/resources/oxml.xml 2013-10-09 19:54:27 UTC (rev 13728)
@@ -38,6 +38,11 @@
                 <xml-element java-attribute="recordingList" xml-path="."/>
             </java-attributes>
         </java-type>
+        <java-type name="Metadata">
+            <java-attributes>
+                <xml-element java-attribute="urlList" xml-path="."/>
+            </java-attributes>
+        </java-type>
         <java-type name="DefAreaElementInner">
             <java-attributes>
                 <xml-element java-attribute="iso31661CodeList" xml-path="."/>
@@ -158,6 +163,11 @@
                 <xml-element java-attribute="iswc" name="iswcs"/>
             </java-attributes>
         </java-type>
+        <java-type name="UrlList">
+            <java-attributes>
+                <xml-element java-attribute="url" name="urls"/>
+            </java-attributes>
+        </java-type>
         <java-type name="Work">
             <java-attributes>
                 <xml-element java-attribute="tagList" xml-path="."/>


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