-->
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: hibernate search automatic indexing problem
PostPosted: Tue Nov 08, 2011 2:56 pm 
Newbie

Joined: Tue Nov 08, 2011 2:01 pm
Posts: 1
Hi,
hibernate-search-3.0.1GA.jar
hibernate-entitymanager-3.3.2GA.jar
spring-core-3..0.1RELEASE.jar

I am facing a problem in automatic indexing,My manuall indexing is working fine, but when new record is saved through hql it does not come into the search result. although it should come, as in hibernate search update the lucene index with every new insert , update and delete.

relevant configuration file is as follow:
applicationContext.xml
Code:
<!-- Hibernate session factory -->
   <bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource" />
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="use_outer_join">${hibernate.use_outer_join}
            </prop>
            <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}
            </prop>
            <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}
            </prop>
            <prop key="hibernate.cache.provider_class">${hibernate.cache.provider}
            </prop>
            <prop key="hibernate.connection.pool_size">10</prop>
            <prop key="hibernate.jdbc.batch_size">30</prop>
            <prop key="hibernate.c3p0.timeout">30000</prop>
            <prop key="hibernate.connection.release_mode">after_statement</prop>
            <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
            <prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
            <prop key="hibernate.search.default.indexBase">C:/var</prop>
            <prop key="org.hibernate.worker.execution">async</prop>
         </props>
      </property>
      <property name="eventListeners">
           <map>
               <entry key="post-update" value-ref="searchListener" />
               <entry key="post-insert" value-ref="searchListener" />
               <entry key="post-delete" value-ref="searchListener" />
              </map>
        </property>
        .....
<!-- search -->
    <bean id="searchListener" class="org.hibernate.search.event.FullTextIndexEventListener" />


HibernateSearchUtil.java
Code:
/**
This method builds the lucene index
   public void createIndex(Class cls,Session session){
      try{
         
         String clsName = cls.getName();
         List list = session.createQuery("from "+clsName).list();
         FullTextSession fullTextSession = Search.createFullTextSession(session);
         Transaction tx = fullTextSession.beginTransaction();
         Iterator it = list.iterator();
         while(it.hasNext())
         {
            Object obj =  it.next();
            fullTextSession.index(obj);
            
         }
         tx.commit();
         System.out.println(clsName + "  has been indexed !");
      }
      catch(Exception exp){exp.printStackTrace();}
   }




any help would be appriciated.
thanks
Code:


Top
 Profile  
 
 Post subject: Re: hibernate search automatic indexing problem
PostPosted: Thu Nov 10, 2011 5:06 am 
Hibernate Team
Hibernate Team

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

first of all, these are terribly old version. I recommend to upgrade Hibernate Core and Search.
Other than that, have you tried setting hibernate.search.indexing_strategy explicitly to event?

--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.