Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2.2 ga
Mapping documents:
Class annotated for search:
@Indexed(index="contacts")
public class Contact extends AbstractBusinessObject {
@Override
@DocumentId
public int getId() {
return super.getId();
}
@Field(name="firstName", index=Index.TOKENIZED, store=Store.YES)
public String getFirstName() {
return firstName;
}
}
In hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<event type="post-update">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-insert">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-delete">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
</session-factory>
</hibernate-configuration>
I use an hbm for the contact class, not annotations. I use spring and also tried adding the event listeners to my LocalSessionFactory config.
<!-- hibernate search -->
<property name="eventListeners">
<map>
<entry key="post-update">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</entry>
<entry key="post-insert">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</entry>
<entry key="post-delete">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"/>
</entry>
</map>
</property>
If this seems correct and more of a spring-related issue, let me know and I'll change forums. Seems like things partially work though....so perhaps someone can steer me in the right direction.
Name and version of the database you are using: MySQL 5.0.22
I have successfully done a manual index on a list of contacts and can search for them successfully. Once an object is indexed, updates to the object seem to be reflected in the index. However, when a new object is created it never gets indexed.
I though that adding the hibernate config would allow all hibernate-managed objects that are search annotated to get indexed on the above events...what am I missing?