Hibernate and Lucene: Where is the index?
smenge Jun 29, 2006 11:48 AMHi all,
I think i got it running, but i dont find the actual index !
I tried my self on a minimal example (the very first example of the Oreilly EJB3 Book:
http://prdownloads.sourceforge.net/jboss/oreilly-ejb3-workbook_for_jboss404_GA.zip?download
Then, I copied lucene-core-2.0.0.jar to "server/default/lib" .
Then, I added these lines to persistence.xml
<property name="hibernate.ejb.event.post-commit-update" value="org.hibernate.lucene.event.LuceneEventListener"/> <property name="hibernate.ejb.event.post-commit-insert" value="org.hibernate.lucene.event.LuceneEventListener"/> <property name="hibernate.ejb.event.post-commit-delete" value="org.hibernate.lucene.event.LuceneEventListener"/> <property name="hibernate.lucene.index_dir" value="/tmp/indexes"/>
Then, I added the annotations to my domain class like this:
@Entity
@Indexed(index="cabinindex")
@Table(name="CABIN")
public class Cabin implements java.io.Serializable
{
private int id;
private String name;
private int deckLevel;
private int shipId;
private int bedCount;
@Id
@Column(name="ID")
@Keyword(id=true)
public int getId()
{
return id;
}
public void setId(int pk)
{
id = pk;
}
@Column(name="NAME")
@Text(name="NAME")
public String getName()
{
return name;
}
public void setName(String str)
{
name = str;
}
...
Everything compiled fine (of course i imported the corresponding package). Then created /tmp/indexes by hand. When deploying, server log says:
17:10:14,619 INFO [LuceneEventListener] Setting index dir to /tmp/indexes 17:10:14,620 INFO [LuceneEventListener] index: /tmp/indexes/cabinindex 17:10:14,620 INFO [LuceneEventListener] Setting index dir to /tmp/indexes 17:10:14,621 INFO [LuceneEventListener] index: /tmp/indexes/cabinindex 17:10:14,621 INFO [LuceneEventListener] Setting index dir to /tmp/indexes 17:10:14,622 INFO [LuceneEventListener] index: /tmp/indexes/cabinindex 17:10:14,622 INFO [SessionFactoryImpl] building session factory 17:10:14,641 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
This tells me that the configuration seems to work.
But (and heres my problem), when running the client, which persists a cabin, no index is appearing, no error messages, nothing. "/tmp/indexes" is empty.
If i had an index, i would like to inspect it with "luke", but until now now success.
Can anyone help me out with this? And: Has anyone got it running? I cant find anything helpful on the net on this topic ...
TIA, Sebastian