-->
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.  [ 4 posts ] 
Author Message
 Post subject: Automatic optimization slows down manual indexing
PostPosted: Fri Sep 11, 2009 4:27 am 
Hello *,

is there a way to disable automatic optimization for manual indexing?

Greetings Matthias


Top
  
 
 Post subject: Re: Automatic optimization slows down manual indexing
PostPosted: Fri Sep 11, 2009 5:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

At the moment there is no way to turn automatic optimization off while manual indexing. There is a new batch inserting backend in the trunk of Search now implemented by Sanne. Not sure how things are handled there.

There is a set- and getOptimizerStrategy in SearchFactoryImpl. You could try to get the current OptimizerStrategy and replace it with a NoOpOptimizerStrategy for the time of the manual indexing. That said, I haven't checked if there are any implications doing this. You definitely have to investigate this closer before going down this path.

--Hardy


Top
 Profile  
 
 Post subject: Re: Automatic optimization slows down manual indexing
PostPosted: Fri Sep 11, 2009 6:32 am 
Thank you for your answer hardy! :)
I think i have to live with this for now and will check your recommendation at the time it is really required.
Have a nice weekend!

Greetings Matthias


Top
  
 
 Post subject: Re: Automatic optimization slows down manual indexing
PostPosted: Fri Sep 11, 2009 8:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
when using the new MassIndexer there are some methods to setup this behaviour:
Code:
MassIndexer m = fulltextSession.createIndexer()
   .optimizeAfterPurge(false)
   .optimizeOnFinish(false);


the "purge" phase is at the beginning, right after the deletion of all older documents; the finish phase is after all new
documents have been added.
The default is true for both, but optimization is always disabled during intermediate steps for top performance (ignoring
automatic optimization settings).

In current stable versions (3.1.x) the default is to not optimize automatically; optimization is enabled if
optimizer.operation_limit.max and/or optimizerStrategy are set in configuration.
So if you want to disable automatic optimization *globally* make sure you don't set this values.

As a temporary hack, and not completely correct, you could cast the SearchFactory to SearchFactoryImpl,
doing so you will be able to expose
Code:
public addOptimizerStrategy(DirectoryProvider<?> provider, OptimizerStrategy optimizerStrategy)
and change the optimizerStrategy for a specific Directory to NoOpOptimizerStrategy.
I was mentioning this as not completely correct as there is no correct synchronization in this use case (the class is sealed at framework's startup): there is no guarantee another thread will "see" the change, but you'll probably use the indexing from the same thread so this should work fine for you.

A more interesting alternative is to implement your own OptimizerStrategy and write the code you like most,
whet I'd recommend however is to try the new MassIndexer.

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


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