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());
/**
* 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) {
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
// to analyze the fields in the incoming user query terms.
LuceneSearcher searcher = new LuceneSearcher(
new LuceneQueryFactory(getAnalyzer(), ALLTEXT),
indexDir);
new LuceneQueryFactory(getAnalyzer(), ALLTEXT), indexDir);
searcher.addObj2Doc(new Entity2LuceneDoc());
context.setAttribute(Searcher.class.getName(), 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
// get objects to index. It is filtered so that non-public text
// does not get into the search index.
WebappDaoFactory wadf =
(WebappDaoFactory) context.getAttribute("webappDaoFactory");
VitroFilters vf =
VitroFilterUtils.getDisplayFilterByRoleLevel(RoleLevel.PUBLIC, wadf);
WebappDaoFactory wadf = (WebappDaoFactory) context.getAttribute("webappDaoFactory");
VitroFilters vf = VitroFilterUtils.getDisplayFilterByRoleLevel(RoleLevel.PUBLIC, wadf);
wadf = new WebappDaoFactoryFiltering(wadf, vf);
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()");
} catch (Throwable t) {
log.error(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
log.error("***** Error setting up Lucene search *****", t);
}
}
@ -152,9 +148,9 @@ public class LuceneSetup implements javax.servlet.ServletContextListener {
}
/**
* In wild card searches the query is first broken into many boolean searches
* OR'ed together. So if there is a query that would match a lot of records
* we need a high max boolean limit for the lucene search.
* In wild card searches the query is first broken into many boolean
* searches OR'ed together. So if there is a query that would match a lot of
* records we need a high max boolean limit for the lucene search.
*
* This sets some static method in the lucene library to achieve this.
*/