-->
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: Does MassIndexer support indexing a list of limited objects?
PostPosted: Thu Oct 14, 2010 12:49 pm 
Beginner
Beginner

Joined: Mon Oct 27, 2008 6:26 am
Posts: 36
Greeting,

I am using Massindexer to index objects I have. It is pretty cool and saves lots of time on indexing.

I need to index a collection of Student objects. One property value of each of students is changed by some logic.

Code is similar as following:

List<Student> students = getLimitedStudentsByCondition();

if(students!=null && students.size()>0)
{
FullTextSession fts = Search.getFullTextSession( sessionFactory.getCurrentSession() );
fts.setFlushMode(FlushMode.MANUAL);
fts.setCacheMode(CacheMode.IGNORE);
int index = 0;
for(Student student:students)
{
index++;
changeValuebyLogic(student);
fts.index(student);
if (index % 1000 == 0)
{
fts.flushToIndexes();
}
}

}

The code is working, however it is quite time consuming compare to Massindexer. I wonder if the Massindexer supports to index a collection of objects? or any other way can improve it.

Thanks

Ian


Top
 Profile  
 
 Post subject: Re: Does MassIndexer support indexing a list of limited objects?
PostPosted: Fri Oct 15, 2010 3:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
no it doesn't support it yet, but we're looking into it.
There's this issue, but I don't plan to implement it only on timestamps, the user should be able to define a criteria / filter.
I'm also looking for good ideas and contributions: if you like to patch the MassIndexer I'll definitely help with it, and we will merge it in the sourcecode.

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


Top
 Profile  
 
 Post subject: Re: Does MassIndexer support indexing a list of limited objects?
PostPosted: Fri Oct 15, 2010 6:31 am 
Beginner
Beginner

Joined: Mon Oct 27, 2008 6:26 am
Posts: 36
Sanne,

Is any other way to batch index a collections of objects?

DO I have to iterate the collections, and index each of objects for now?

Thanks

Ian


Top
 Profile  
 
 Post subject: Re: Does MassIndexer support indexing a list of limited objects?
PostPosted: Fri Oct 15, 2010 12:05 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
yes for now you have to iterate on the objects you want to update.

See http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#search-batchindex-flushtoindexes for examples of efficient scrolling and indexing, make sure you use .flushToIndexes(); and .clear() periodically.
This is very efficient, compared to the MassIndexer it's just lacking the multithreaded approach.

Compared to your example, remember that loading the List in memory might consume more memory than you might expect ;) so follow the suggestion to use scrollable result sets.

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


Top
 Profile  
 
 Post subject: Re: Does MassIndexer support indexing a list of limited objects?
PostPosted: Wed Oct 20, 2010 4:41 am 
Beginner
Beginner

Joined: Mon Oct 27, 2008 6:26 am
Posts: 36
thanks


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.