Adding exception checking to IndividualListController.java NIHVIVO-1687
This commit is contained in:
parent
abd5c89497
commit
4e0b942d91
1 changed files with 10 additions and 6 deletions
|
@ -181,15 +181,19 @@ public class EntityListController extends VitroHttpServlet {
|
||||||
|
|
||||||
//execute lucene query for individuals of the specified type
|
//execute lucene query for individuals of the specified type
|
||||||
IndexSearcher index = LuceneIndexFactory.getIndexSearcher(context);
|
IndexSearcher index = LuceneIndexFactory.getIndexSearcher(context);
|
||||||
TopDocs docs = index.search(query, null,
|
TopDocs docs = null;
|
||||||
|
try{
|
||||||
|
docs = index.search(query, null,
|
||||||
ENTITY_LIST_CONTROLLER_MAX_RESULTS,
|
ENTITY_LIST_CONTROLLER_MAX_RESULTS,
|
||||||
new Sort(Entity2LuceneDoc.term.NAMEUNANALYZED));
|
new Sort(Entity2LuceneDoc.term.NAMEUNANALYZED));
|
||||||
|
}catch(Throwable th){
|
||||||
if( docs == null ){
|
log.error("Could not run search. " + th.getMessage());
|
||||||
log.error("Search of lucene index returned null");
|
docs = null;
|
||||||
throw new ServletException("Search of lucene index returned null");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( docs == null )
|
||||||
|
throw new ServletException("Could not run search in EntityListController");
|
||||||
|
|
||||||
//get list of individuals for the search results
|
//get list of individuals for the search results
|
||||||
int size = docs.totalHits;
|
int size = docs.totalHits;
|
||||||
// don't get all the results, only get results for the requestedSize
|
// don't get all the results, only get results for the requestedSize
|
||||||
|
|
Loading…
Add table
Reference in a new issue