-->
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.  [ 6 posts ] 
Author Message
 Post subject: .cfs lucene indexing file
PostPosted: Tue Mar 04, 2008 9:45 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
Hi!

I'm trying to index a persisted entity in a DB via Hibernate Search. Everything seems to be ok: the process ends without error but in the lucene's index directory there are just the files: segments_gen and segments_1. I mean, there is not a .cfs file. Any idea?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 4:50 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I think you have to give a little more details. There might be multiple reasons why things could go wrong. How do your entities look like including the Hibernate Search annotations? How do you do the initial indexing.

Have a look at http://hibernate.org/440.html. Maybe it helps. Download and start Luke and check your index. Probably it is empty as you say, but once you know how to use Luke it should be very easy to check your index.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 4:40 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
Hi!

When I open the index with Luke, it says that the index is corrupt. In the index directory there are just two files: segments.gen and segments_1.

My entity is:

@Entity
@Indexed
public class Book {

@Id
@DocumentId
private Integer id;

@Field(index=Index.TOKENIZED, store=Store.NO)
private String body;

@Field(index=Index.TOKENIZED, store=Store.NO)
private String summary;

public Book() {
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 4:43 am 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
Here is the indexing code:

EntityManager em = JpaUtil.getEntityManager(this.getJpaTemplate().getEntityManagerFactory());
FullTextEntityManager fullTextEntityManager = Search.createFullTextEntityManager(em);

List<Book> books = em.createQuery("select book from Book as book").getResultList();
for (Book book : books) {
try {
fullTextEntityManager.index(book);

} catch (Exception e) {
e.printStackTrace();
}
}



Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 4:40 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Looks ok. I assume that you've checked the books list is not empty and that this code executes within a transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 6:46 pm 
Beginner
Beginner

Joined: Wed Feb 27, 2008 12:34 pm
Posts: 21
Yes. I've checked the list size and it's the number of records of the DB.

Another strange thing is that if I create the index directly using the Lucene API, the file .cfs appears.

Thanks a lot.


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