NIHVIVO-2437 Upgrade to Solr 3.1

This commit is contained in:
ryounes 2011-05-16 21:58:24 +00:00
parent ad98e7723c
commit 265a86019c
27 changed files with 7060 additions and 2693 deletions

View file

@ -14,7 +14,6 @@ import net.sf.jga.fn.UnaryFunctor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.analysis.HTMLStripReader;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
@ -141,23 +140,27 @@ public abstract class VitroHighlighter extends UnaryFunctor<String,String> {
private final String stripHtml(String in){
/* make a string with html stripped out */
Reader stripIn =new HTMLStripReader( new StringReader( in ) );
StringWriter stripOut = new StringWriter(in.length());
char bytes[] = new char[5000];
int bytesRead = 0;
try {
//this is a mess, there must be a better way to do this.
while ( true ){
bytesRead = stripIn.read( bytes );
if( bytesRead == -1 ) break;
stripOut.write(bytes, 0, bytesRead );
}
} catch (IOException e1) {
log.error("LuceneHighlighter.getHighlightFragments()" +
" - unable to strip html" + e1);
}
return stripOut.toString();
// ryounes 5/16/2011 Broken with upgrade to Solr 3.1: HTMLStripReader has been removed.
// According to change list, should use HTMLStripCharFilter, but it's not immediately clear how
// to migrate this code. Will enter Jira issue.
// Reader stripIn = new HTMLStripReader( new StringReader( in ) );
// StringWriter stripOut = new StringWriter(in.length());
//
// char bytes[] = new char[5000];
// int bytesRead = 0;
// try {
// //this is a mess, there must be a better way to do this.
// while ( true ){
// bytesRead = stripIn.read( bytes );
// if( bytesRead == -1 ) break;
// stripOut.write(bytes, 0, bytesRead );
// }
// } catch (IOException e1) {
// log.error("LuceneHighlighter.getHighlightFragments()" +
// " - unable to strip html" + e1);
// }
// return stripOut.toString();
return in;
}
}

View file

@ -141,7 +141,7 @@ public class PagedSearchController extends FreemarkerHttpServlet implements Sear
//There may be other non-html formats in the future
Format format = getFormat(vreq);
boolean wasXmlRequested = Format.XML == format;
log.debug("xml was the requested format");
log.debug("Requested format was " + (wasXmlRequested ? "xml" : "html"));
boolean wasHtmlRequested = ! wasXmlRequested;
try {

View file

@ -128,7 +128,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet {
//There may be other non-html formats in the future
Format format = getFormat(vreq);
boolean wasXmlRequested = Format.XML == format;
log.debug("xml was the requested format");
log.debug("Requested format was " + (wasXmlRequested ? "xml" : "html"));
boolean wasHtmlRequested = ! wasXmlRequested;
try {