-->
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.  [ 2 posts ] 
Author Message
 Post subject: Manual Indexing using CDI
PostPosted: Tue Jan 08, 2013 8:05 am 
Newbie

Joined: Mon Dec 24, 2012 6:32 am
Posts: 17
Hi All,
I want to perform manual indexing for a view. I am using JPA and FullTextEntityManager.I am using CDI for injecting the EntityManager. The entity manager is a JTA Entity manager. My problem is that it is not indexing the new Entity. It is not throwing any exception/error either. I think the problem lies with committing the change in the index. Although CDI commits after the transaction so technically it should work but its not.
Please Help.
Thanks in advance,
Code:
   @Inject
   EntityManager entityManager;

   public void startIndexer(RetailCustomerDetail retailCustomerDetails,
         List<CustomerIdentityDetail> customerIdentityDetails) {
      FullTextEntityManager fullTextEntityManager = Search
            .getFullTextEntityManager(entityManager);
      try {
         for (CustomerIdentityDetail customerIdentityDetail : customerIdentityDetails) {
            

                              Long id = Long.valueOf(customerIdentityDetail.getCompositePK()
                  .getId());
            Query query = entityManager
                  .createNamedQuery(CustomerSearch.FIND_BY_ID);
            query.setParameter(1, id);
            List<CustomerSearch> customerSearchDetails = query
                  .getResultList();
// important part
            for (CustomerSearch customerSearch : customerSearchDetails) {
               fullTextEntityManager.index(customerSearch);
            }
         }   
      }

_________________
Sourabh Ghorpade


Top
 Profile  
 
 Post subject: Re: Manual Indexing using CDI
PostPosted: Fri Jan 11, 2013 5:48 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

how do you know that there is no indexing occurring? Is there a Lucene index on disk? Did you inspect it with Luke?

I recommend you turn on debug logging to check what's happening. If there is some indexing you should see debug information from the relevant Hibernate Search classes. Since you are using the explicit indexing API I would expect that the index gets updated. How is your indexed Entity (CustomerSearch) annotated?

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.