Hi,
I updated to all the compliant versions and jars and am trying a simple lucene query over my models, which I store/retrieve already.
Here is the code:
Code:
FullTextSession fullTextSession = Search.createFullTextSession(
session);
org.apache.lucene.queryParser.QueryParser parser = new QueryParser(
defaultField, new StopAnalyzer());
org.apache.lucene.search.Query luceneQuery = parser.parse(query);
org.hibernate.Query fullTextQuery = fullTextSession.createFullTextQuery(
luceneQuery);
List result = fullTextQuery.list(); //return a list of managed objects
return result;
Other useful snips:
Code:
<property name="current_session_context_class">thread</property>
<property name="hibernate.search.default.indexDir">C:\hibernate\indexes</property>
<property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
I am running hibernate in local thread, not container.
Thanks for any tips.
Darren
org.hibernate.HibernateException: getListeners is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy14.getListeners(Unknown Source)
at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:22)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:145)
at mil.darpa.tn.model.ReportModelFactory.searchReports(ReportModelFactory.java:127)
at mil.darpa.tn.model.ReportFactory.searchReports(ReportFactory.java:82)
at mil.darpa.tn.TNMain.main(TNMain.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:202)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:134)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:710)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:178)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:240)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:293)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:131)