-->
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.  [ 2 posts ] 
Author Message
 Post subject: EntityManager automatically indexes object. Can I disable?
PostPosted: Wed Apr 15, 2009 2:03 pm 
Newbie

Joined: Mon Mar 23, 2009 12:46 pm
Posts: 6
So I'm writing some tests for my search class and reindexer and i seemed to encounter a problem.

The gist of the problem is when I'm testing my reindexer the basics of the test are i do a search on a term that cannot be found, then i create an object with that term, merge it into the entityManager, reindex and search again. The issue is when I merge the object into the entityManager it also creates an index for the object which would be fine regularly, but since i'm testing the reindexer it kind of defeats the purpose.

is there any way i can disable this behavior? I think the problem may be related to my directory_provider only because this behavior started showing up when i switched from my own directory provider to the FSDirectoryProvider.

Thanks


Top
 Profile  
 
 Post subject: Re: EntityManager automatically indexes object. Can I disabl
PostPosted: Thu Apr 16, 2009 5:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Quote:
The issue is when I merge the object into the entityManager it also creates an index for the object which would be fine regularly, but since i'm testing the reindexer it kind of defeats the purpose.

I am not following here. If automatic indexing is enabled creating an object will cause a new Lucene Document to be added to the index. This is how it should be. Maybe you should turn of automatic indexing then for your tests.
Maybe you can explain a little more what you actually want to test.

Regarding testing I recommend using a RAMDirectoryProvider. This means that between tests you always start with a fresh index. When using a FSDirectoryProvider you have to make sure that the index is purged between tests to avoid any unexpected behavior due to stale data.

--Hardy


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