-->
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: Manually Indexing records from the Database
PostPosted: Sun May 04, 2008 5:17 am 
Newbie

Joined: Sun Jun 18, 2006 9:47 pm
Posts: 6
I have written a timed program that a certain time selects all recently added records from the Database and then attempts to build indexes from this records which would be added to the existing Lucene records.

Code:
Session session = super.getSession();
      FullTextSession fullTextSession = Search.createFullTextSession(session);
List<JobDescription> jobDescriptions = jobDescriptionDAO
            .findByDate(searchEngineDAO.findMaxDate());
   for (JobDescription jobDescription : jobDescriptions) {
         fullTextSession.index(jobDescription);//Build Indexes and Add
         }
      }



Problem is it only works the first time I add a record, That is the first time it runs it builts index and places it in the directory , the second time it does'nt build the index unless i manually delete the existing Index files in the Lucene Directory, any help would be appreciated

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3


Name and version of the database you are using:MySQL


[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 7:06 am 
Hibernate Team
Hibernate Team

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

how do you know that indexing is not working on the 'second time'? Have you inspected your index using Luke (http://hibernate.org/440.html) before and after the scheduled indexing? Given that fiels get recreated in case that you delete them seems to indicate that something is happening.

Also, your example code does not contain any information about transactions. I assume the indexing is happening within a transaction? Maybe you could provide more information about your code.

--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.