Galera,
Estou com seguinte problema no Hibernate Search.
HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync!
ERROR [http-bio-8080-exec-15] (LogErrorHandler.java:83) - HSEARCH000058: HSEARCH000117: IOException on the IndexWriter
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@C:\Users\Public\indexes\br.com.mitter.modelo.ModeloVeiculo\write.lock
Para resolver de forma “quebra galho” colocamos a seguinte linha no persistence.xml
<property name="hibernate.search.default.exclusive_index_use" value="false" />
Abaixo o meu codigo que estou utilizando:
EntityManager em = null;
try {
em = EntityManagerHelper.getEntityManager();
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_35);
QueryParser parser = new QueryParser(Version.LUCENE_35, "nome", analyzer);
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
fullTextEntityManager.createIndexer().startAndWait();
em.getTransaction().begin();
org.apache.lucene.search.Query query = parser.parse(proprietario.getNome());
javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Proprietario.class);
List<Proprietario> result = persistenceQuery.getResultList();
return result;
} catch (Exception e) {
throw new FrotaWebException(e);
} finally {
em.getTransaction().commit();
em.close();
}
Alguem tem alguma ideia do que pode ser?