Discussion:
[mb-commits] r13748 - 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/test/java/org/musicbrainz/search/servlet
root
2014-04-28 21:03:22 UTC
Permalink
Author: ijabz
Date: 2014-04-28 21:03:18 +0000 (Mon, 28 Apr 2014)
New Revision: 13748

Added:
search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/SeriesDismaxSearch.java
search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/SeriesQueryParser.java
search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/SeriesSearch.java
search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/SeriesWriter.java
search_server/trunk/servlet/src/test/java/org/musicbrainz/search/servlet/FindSeriesTest.java
Modified:
search_server/trunk/index/src/main/java/org/musicbrainz/search/index/SeriesIndex.java
search_server/trunk/index/src/test/java/org/musicbrainz/search/index/SeriesIndexTest.java
search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java
Log:
SEARCH-357:Series search support

Modified: search_server/trunk/index/src/main/java/org/musicbrainz/search/index/SeriesIndex.java
===================================================================
--- search_server/trunk/index/src/main/java/org/musicbrainz/search/index/SeriesIndex.java 2014-04-28 14:48:29 UTC (rev 13747)
+++ search_server/trunk/index/src/main/java/org/musicbrainz/search/index/SeriesIndex.java 2014-04-28 21:03:18 UTC (rev 13748)
@@ -27,6 +27,7 @@
import org.musicbrainz.mmd2.Alias;
import org.musicbrainz.mmd2.AliasList;
import org.musicbrainz.mmd2.ObjectFactory;
+import org.musicbrainz.mmd2.Series;
import org.musicbrainz.search.MbDocument;
import org.musicbrainz.search.analysis.MusicbrainzSimilarity;

@@ -178,29 +179,29 @@
MbDocument doc = new MbDocument();

ObjectFactory of = new ObjectFactory();
- //Series series = of.createSeries();
+ Series series = of.createSeries();

int seriesId = rs.getInt("id");
doc.addField(SeriesIndexField.ID, seriesId);

String seriesGuid = rs.getString("gid");
doc.addField(SeriesIndexField.SERIES_ID, seriesGuid);
- //series.setId(seriesGuid);
+ series.setId(seriesGuid);

String name=rs.getString("name");
doc.addField(SeriesIndexField.SERIES,name );
- //series.setName(name);
+ series.setName(name);

String type = rs.getString("type");
doc.addFieldOrUnknown(SeriesIndexField.TYPE, type);
if (!Strings.isNullOrEmpty(type)) {
- // series.setType(type);
+ series.setType(type);
}

String comment = rs.getString("comment");
doc.addFieldOrNoValue(SeriesIndexField.COMMENT, comment);
if (!Strings.isNullOrEmpty(comment)) {
- // series.setDisambiguation(comment);
+ series.setDisambiguation(comment);
}

String orderAttr = rs.getString("ordering_attribute");
@@ -217,11 +218,11 @@
}
aliasList.getAlias().add(nextAlias);
}
- // series.setAliasList(aliasList);
+ series.setAliasList(aliasList);
}

- //String store = MMDSerializer.serialize(series);
- //doc.addField(SeriesIndexField.INSTRUMENT_STORE, store);
+ String store = MMDSerializer.serialize(series);
+ doc.addField(SeriesIndexField.SERIES_STORE, store);
return doc.getLuceneDocument();
}


Modified: search_server/trunk/index/src/test/java/org/musicbrainz/search/index/SeriesIndexTest.java
===================================================================
--- search_server/trunk/index/src/test/java/org/musicbrainz/search/index/SeriesIndexTest.java 2014-04-28 14:48:29 UTC (rev 13747)
+++ search_server/trunk/index/src/test/java/org/musicbrainz/search/index/SeriesIndexTest.java 2014-04-28 21:03:18 UTC (rev 13748)
@@ -1,10 +1,12 @@
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;
import org.apache.lucene.store.RAMDirectory;
import org.junit.Test;
+import org.musicbrainz.mmd2.Series;

import java.sql.Statement;

@@ -123,7 +125,7 @@
}
ir.close();
}
- /*
+
@Test
public void testStoredIndexSeries() throws Exception {

@@ -149,5 +151,4 @@
}
ir.close();
}
- */
}
\ No newline at end of file

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 14:48:29 UTC (rev 13747)
+++ search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/ResourceType.java 2014-04-28 21:03:18 UTC (rev 13748)
@@ -21,6 +21,7 @@
CDSTUB("cdstub", CDStubIndex.class, CDStubSearch.class, CDStubDismaxSearch.class, false),
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),
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),
Loading...