Cannot Reproduce
Details
Assignee
UnassignedUnassignedReporter
S Ravi BhaskarS Ravi BhaskarComponents
Affects versions
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
S Ravi Bhaskar
S Ravi BhaskarComponents
Affects versions
Priority
Created April 21, 2009 at 8:14 PM
Updated July 1, 2010 at 12:42 PM
Resolved April 8, 2010 at 5:08 PM
The below code throws an AlreadyClosedException when trying to open the lucene index. Junit test to test it works from eclipse, fails in an ant build.
I suspect it is trying to reuse a handle to the index. Please let me know if you need more information.
I had to bump back my hibernate search version to 3.0.1 GA, and then it started working. I am getting by, but would ideally like to use 3.1.0 GA without this exception. I think it has something to do with Search.getFullTextEntityManager((getJpaPersistenceContext().getEntityManager())); VS Search.createFullTextEntityManager((getJpaPersistenceContext().getEntityManager())); in the older version.
String query = "BlahBlahBlah";
org.apache.lucene.queryParser.QueryParser parser = new QueryParser("ItemTitle", new StandardAnalyzer() );
org.apache.lucene.search.Query luceneQuery;
try {
luceneQuery = parser.parse(query);
} catch (ParseException e) {
// TODO Auto-generated catch block
logger.error(String.format("Error parsing search querystring "));
return null;
}
javax.persistence.Query fullTextQuery = createFullTextEntityManager().createFullTextQuery(luceneQuery, klass);
List result = fullTextQuery.getResultList(); // return a list of managed
where createFullTextEntityManager() is
public FullTextEntityManager createFullTextEntityManager() {
return Search.getFullTextEntityManager((getJpaPersistenceContext().getEntityManager()));
}