Hi, We are indexing a table with approx 125000 rows in using hibernate search. The loop over the objects works fine but when it hits flushToIndexes() it takes approx 10 mins to start the next batch. This is causing our index to be ridiculously slow and, as this is one table of about 30, causes our index to not complete!
| @SuppressWarnings("unchecked") | public void indexEntity(Class entityClass) { | LOG.debug("Indexing " + entityClass.getName()); | | fullTextSession.setFlushMode(FlushMode.MANUAL); | fullTextSession.setCacheMode(CacheMode.IGNORE); | | // Scrollable results will avoid loading too many objects in memory | ScrollableResults results = fullTextSession.createCriteria(entityClass) | .setFetchSize(BATCH_SIZE).scroll(ScrollMode.FORWARD_ONLY); | | int index = 0; | | while (results.next()) { | index++; | fullTextSession.index(results.get(0)); // index each element | if (index % BATCH_SIZE == 0) { | fullTextSession.flushToIndexes(); // apply changes to indexes | fullTextSession.clear(); // clear since the queue is processed | } | } | results.close(); | fullTextSession.setFlushMode(FlushMode.AUTO); | } | Anyone any ideas? If you need the class file let me know... Cheers Martin View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227691#4227691 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227691 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user