I am trying to create a hibernate full text search using hibernate-search-4.3.0.Final.jar There is no errors in this application, but my Lucene query unsing the query DSL doesn't return any results. I mean It doesn't return any of rows in the table. can any one please help me.
This is my function:
Code:
OgmConfiguration cfgogm=new OgmConfiguration();
cfgogm.configure("hibernate.cfg.xml");
serviceregistry=new ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
sessionfactory=cfgogm.buildSessionFactory(serviceregistry);
Session session= sessionfactory.openSession();
FullTextSession fulltextsession= Search.getFullTextSession(session);
QueryBuilder querybuilder=fulltextsession.getSearchFactory().buildQueryBuilder().forEntity(User.class).get();
org.apache.lucene.search.Query lucenequery=querybuilder.keyword().onField("IdU").matching("96645").createQuery();
org.hibernate.search.FullTextQuery fulltextquery=fulltextsession.createFullTextQuery(lucenequery, User.class);
List result=fulltextquery.list();
System.out.println(result.toString());
and this is my POJO class:
Code:
@Entity
@Table(name="Users")
@Indexed
public class User {
@Id
@GeneratedValue(generator="mongodb_uuidgg")
@Field(index = Index.YES,analyze = Analyze.NO,store = Store.NO)
private String _id;
@Column(name="City")
@Field(index = Index.YES,analyze = Analyze.NO,store = Store.NO)
private String city;
@Column(name="UserID")
@Field(index = Index.YES,analyze = Analyze.NO,store = Store.NO)
private int IdU;
...