Hi,
I am currently trying to get Play Framework (v 1.2.4) to work with Hibernate Search (v3.6, Hibernate Core 3.4).
I have succesfully managed to get the model to persist and create the index directory alongside numerous files, with the following extensions:-.fnm, .frq, .nrm, .prx, .tii, .tis,...segments.gen and segments_11. Each of these are getting touched when the fullTextEntityManager.persist(User) is being called but nothing exists in the index. Tried to use Luke to open the index but that fails too.
Ok so here's the code:
Code:
public static void index() {
EntityManager em = JPA.entityManagerFactory.createEntityManager();
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
try {
fullTextEntityManager.createIndexer().startAndWait();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
EntityTransaction trx = fullTextEntityManager.getTransaction();
trx.begin();
User user = new User("firstname", "surname");
fullTextEntityManager.persist(user);
trx.commit();
render();
}
and the User:
Code:
@Entity
@Indexed(index="User")
public class User extends GenericModel {
public User(){}
public User(String fn, String usn) {
firstname = fn;
surname = usn;
}
@DocumentId
@Id
@GeneratedValue
public Long user_id;
@Field(index=Index.UN_TOKENIZED)
public String firstname;
@Field(index=Index.UN_TOKENIZED)
public String surname;
}
Can someone throw some light onto why it's failing to update the index please?
Thanks