Reindaxece fulltextu se spouští asynchronně- rychlejší start aplikace

Verze_2.0
Josef Rokos 10 years ago
parent 9ec15943ed
commit 566b408ddd

@ -5,17 +5,6 @@ import info.bukova.isspst.dao.QueryDao;
import info.bukova.isspst.data.BaseData;
import info.bukova.isspst.data.User;
import info.bukova.isspst.sort.ReflectionTools;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.lucene.search.Query;
import org.hibernate.Hibernate;
import org.hibernate.search.FullTextSession;
@ -28,6 +17,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
public class FullTextServiceImpl implements FullTextService {
@Autowired
@ -48,11 +43,7 @@ public class FullTextServiceImpl implements FullTextService {
Logger logger = LoggerFactory.getLogger(FullTextServiceImpl.class);
logger.info("Indexing database for fulltext search");
FullTextSession ftSession = Search.getFullTextSession(queryDao.getSession());
try {
ftSession.createIndexer().startAndWait();
} catch (InterruptedException e) {
logger.error("Cannot index database");
}
ftSession.createIndexer().start();
}
@Override

Loading…
Cancel
Save