-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Search-Play Framework-Index Not Updating
PostPosted: Tue Dec 27, 2011 7:23 pm 
Beginner
Beginner

Joined: Wed Feb 09, 2011 6:49 am
Posts: 22
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


Top
 Profile  
 
 Post subject: Re: Hibernate Search-Play Framework-Index Not Updating
PostPosted: Wed Dec 28, 2011 8:57 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
don't you see any error in the logs? How do you know it's not indexing?
If it's touching the index files (and creating them) I would assume that the index is being written; you might have an issue in the search definition so it fails finding anything. How are you making a query?

Quote:
Tried to use Luke to open the index but that fails too.

How does that fail? Make sure you use a Luke version compatible with the Lucene version you're using.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibernate Search-Play Framework-Index Not Updating
PostPosted: Thu Dec 29, 2011 6:34 pm 
Beginner
Beginner

Joined: Wed Feb 09, 2011 6:49 am
Posts: 22
Hi,

Right, have this working. Had to read through the lucene 3.1 docs to understand what was happening. And after downloading the correct Luke version i now can integrate hibernate search with play framework..well the peristence at least..now need to test the search

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.