-->
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: Index is not getting created
PostPosted: Fri Dec 07, 2007 1:26 am 
Newbie

Joined: Thu Dec 06, 2007 11:40 pm
Posts: 6
Hi,
new to this text search thing and need some help.

Have JPA implementation for my datastore and would like to add text searching to it.

Got latest jars as required and all properties are included in my persitance.xml. When I try to create index I just get two segmented files. I am including my config files and method how I am going after creating index. I suspect indexing is being interrupted but not sure why. Maybe there is something totally obvious I am missing here.Any help would be appreciated.

persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">
<!-- persistence-unit name="punit" -->
<persistence-unit name="testPU"
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/db" />
<property name="hibernate.connection.username" value="dd" />
<property name="hibernate.connection.password"
value="dd" />
<property name="hibernate.search.default.directory_provider"
value="org.hibernate.search.store.FSDirectoryProvider" />
<property name="hibernate.search.default.indexBase"
value="c:\\work\\temp\\lucene\\indexes" />
<property name="hibernate.ejb.event.post-insert"
value="org.hibernate.search.event.FullTextIndexEventListener" />
<property name="hibernate.ejb.event.post-update"
value="org.hibernate.search.event.FullTextIndexEventListener" />
<property name="hibernate.ejb.event.post-delete"
value="org.hibernate.search.event.FullTextIndexEventListener" />
</properties>
</persistence-unit>
</persistence>


this how I create index:


public void createIndex() {
System.out.println("createIndex");
EntityManager em = getEntityManager();
FullTextEntityManager fullTextEntityManager = Search
.createFullTextEntityManager(em);
List<Author> authors = em.createQuery("select p FROM Author p")
.getResultList();
for (Author author : authors) {
System.out.println("authors : " + author.getAuthorName());
}
System.out.println(" Result : " + authors.size());

"I get here correct number of records from BD"


for (Author author : authors) {
fullTextEntityManager.index(authors);
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 07, 2007 2:24 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
fullTextEntityManager.index(authors);

should be
Code:
fullTextEntityManager.index(author);

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 12:05 pm 
Newbie

Joined: Thu Dec 06, 2007 11:40 pm
Posts: 6
Thanks, looks like I was totally blind.


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.