NIHVIVO-721 Make indenting consistent. Standardize error logging.

This commit is contained in:
jeb228 2010-07-13 20:52:23 +00:00
parent 44df1e5008
commit 0e721dcb22

View file

@ -65,7 +65,8 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
private static final Log log = LogFactory.getLog(LuceneSetup.class.getName()); private static final Log log = LogFactory.getLog(LuceneSetup.class.getName());
/** /**
* Gets run to set up DataSource when the webapp servlet context gets created. * Gets run to set up DataSource when the webapp servlet context gets
* created.
*/ */
public void contextInitialized(ServletContextEvent sce) { public void contextInitialized(ServletContextEvent sce) {
try { try {
@ -96,8 +97,7 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
// the queries need to know the analyzer to use so that the same one can be used // the queries need to know the analyzer to use so that the same one can be used
// to analyze the fields in the incoming user query terms. // to analyze the fields in the incoming user query terms.
LuceneSearcher searcher = new LuceneSearcher( LuceneSearcher searcher = new LuceneSearcher(
new LuceneQueryFactory(getAnalyzer(), ALLTEXT), new LuceneQueryFactory(getAnalyzer(), ALLTEXT), indexDir);
indexDir);
searcher.addObj2Doc(new Entity2LuceneDoc()); searcher.addObj2Doc(new Entity2LuceneDoc());
context.setAttribute(Searcher.class.getName(), searcher); context.setAttribute(Searcher.class.getName(), searcher);
indexer.addSearcher(searcher); indexer.addSearcher(searcher);
@ -105,10 +105,8 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
// This is where the builder gets the list of places to try to // This is where the builder gets the list of places to try to
// get objects to index. It is filtered so that non-public text // get objects to index. It is filtered so that non-public text
// does not get into the search index. // does not get into the search index.
WebappDaoFactory wadf = WebappDaoFactory wadf = (WebappDaoFactory) context.getAttribute("webappDaoFactory");
(WebappDaoFactory) context.getAttribute("webappDaoFactory"); VitroFilters vf = VitroFilterUtils.getDisplayFilterByRoleLevel(RoleLevel.PUBLIC, wadf);
VitroFilters vf =
VitroFilterUtils.getDisplayFilterByRoleLevel(RoleLevel.PUBLIC, wadf);
wadf = new WebappDaoFactoryFiltering(wadf, vf); wadf = new WebappDaoFactoryFiltering(wadf, vf);
List<ObjectSourceIface> sources = new ArrayList<ObjectSourceIface>(); List<ObjectSourceIface> sources = new ArrayList<ObjectSourceIface>();
@ -136,9 +134,7 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
log.debug("**** End of " + this.getClass().getName() + ".contextInitialized()"); log.debug("**** End of " + this.getClass().getName() + ".contextInitialized()");
} catch (Throwable t) { } catch (Throwable t) {
log.error(t); log.error("***** Error setting up Lucene search *****", t);
System.out.println("***** Error setting up Lucene search *****");
t.printStackTrace(); // because Tomcat doesn't display listener errors in catalina.out, at least by default
} }
} }
@ -152,9 +148,9 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
} }
/** /**
* In wild card searches the query is first broken into many boolean searches * In wild card searches the query is first broken into many boolean
* OR'ed together. So if there is a query that would match a lot of records * searches OR'ed together. So if there is a query that would match a lot of
* we need a high max boolean limit for the lucene search. * records we need a high max boolean limit for the lucene search.
* *
* This sets some static method in the lucene library to achieve this. * This sets some static method in the lucene library to achieve this.
*/ */