-->
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.  [ 3 posts ] 
Author Message
 Post subject: manual batching with hibernate search 3.0.0 not working.
PostPosted: Mon Jun 30, 2008 12:29 pm 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2.6 GA

Mapping documents:
Code:
@Indexed(index="User")
public class User implements UserDetails {
    private static final long serialVersionUID = 5636489207599885697L;

    @DocumentId
    private Integer id;
    protected Status status;

    @Field(index=Index.TOKENIZED, store=Store.YES)
    @Analyzer(impl=KeywordAnalyzer.class)
    @Boost(value=2)
    protected String username;

    @Field(index=Index.TOKENIZED, store=Store.YES)
    @Analyzer(impl=KeywordAnalyzer.class)
    @Boost(value=2)
    protected String email;

    protected String password;

    @Field(index=Index.TOKENIZED, store=Store.YES)
    @Analyzer(impl=KeywordAnalyzer.class)
    @Boost(value=2)
    protected String firstname;

    @Field(index=Index.TOKENIZED, store=Store.YES)
    @Analyzer(impl=KeywordAnalyzer.class)
    @Boost(value=2)
    protected String lastname;
}



Code between sessionFactory.openSession() and session.close():
Code:
public void batchProcessUserIndex()
{
    Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
        FullTextSession fullTextSession = Search.createFullTextSession(session);
        ScrollableResults scr = fullTextSession.createCriteria(User.class).scroll(ScrollMode.FORWARD_ONLY);
        while (scr.next())
        {
            fullTextSession.index(scr.get(0));
        }
}


I am using aop and transaction advice.

here is my setting
Code:
        <tx:method name="batchProcessUserIndex" propagation="SUPPORTS" isolation="READ_UNCOMMITTED"/>


Code:
<hibernate-configuration>
<session-factory>
<event type="post-update">
            <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
        </event>
        <event type="post-insert">
            <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
        </event>
        <event type="post-delete">
            <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
        </event>
</session-factory>
</hibernate-configuration>


here is my test class.

i created a class which extends AbstractSpringTransactionalTestCase and i have test case which test batchProcessUserIndex.

The process takes about 3 minutes to run over large amount of data. However when i look at actual directory, the size of segments and file data is like 1 kb. very small. The database contains over 100,000 users.

Thanks.


Last edited by cablepuff on Mon Aug 18, 2008 9:51 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 12:30 pm 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
follow up question.

how would i do manual indexing with spring 2.5.5 and hibernate 3.0.0, hibernate GA 3.2.6


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 1:02 am 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
i realize my mistake i missed

Code:
transaction tx = session.getTransaction();

.....
tx.commit();


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