-->
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.  [ 5 posts ] 
Author Message
 Post subject: index reinitialization
PostPosted: Wed May 14, 2008 6:04 am 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
Hello
Is it possible to completely delete all data in HS?
I remap all of my entities, and so I need to rebuild index from scratch. I know hopw to iterate over all objects and index them, but how to clear index?
I know I can delete files with indexes from disk, but I would like rather do it programatically.
So I need:
1)delete all objects
2)compact indexes
3)reindex all objects

I know how to do 2) and 3), but what about 1)? I don't want to remove from index one by one object, I believe there is simpler method


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 7:18 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,

have you seen the purgeAll method?
http://www.hibernate.org/hib_docs/search/reference/en/html_single/#d0e2316

Quote:
I don't want to remove from index one by one object, I believe there is simpler method

You could delete the index files programmatically; but it would be preferrable to stop Hibernate Search before doing so; also you have to restart it to have new indexes created.

In alternative you could delete the files and then write a new empty index using the Lucene api (see IndexWriter), but you should interact with the Hibernate Search locking system to be safe.

I'm not sure what could happen if you replace the index without using the locks, I could look at it if you can't stop the system.

regards,

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 7:50 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
I verified the purgeAll method does not iterate on the objects one by one,
so for each indexed entity you just have to:
1)purgeAll
2)optimize
3)reindex all

regards,

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 03, 2008 4:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
use purgeAll as Sanne said

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 03, 2008 5:40 pm 
Beginner
Beginner

Joined: Thu Feb 28, 2008 4:58 am
Posts: 37
purgeAll works ok.


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