From: <man...@us...> - 2010-04-01 09:43:05
|
Revision: 1346 http://j-trac.svn.sourceforge.net/j-trac/?rev=1346&view=rev Author: manfredwolff Date: 2010-04-01 09:42:57 +0000 (Thu, 01 Apr 2010) Log Message: ----------- ID: #2979960: Solves problem with the indexer with databases which does not supports autoincrement index fields. Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java Modified: trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java 2009-12-15 12:00:57 UTC (rev 1345) +++ trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java 2010-04-01 09:42:57 UTC (rev 1346) @@ -776,14 +776,18 @@ batchInfo.setTotalSize(totalSize); logger.info("total items to index: " + totalSize); int firstResult = 0; + long lastFetchedId = 0; while(true) { logger.info("processing batch starting from: " + firstResult + ", current: " + batchInfo.getCurrentPosition()); List<Item> items = dao.findAllItems(firstResult, batchInfo.getBatchSize()); for (Item item : items) { - indexer.index(item); + + indexer.index(item); + // currently history is indexed separately from item // not sure if this is a good thing, maybe it gives // more flexibility e.g. fine-grained search results + int historyCount = 0; for(History history : item.getHistory()) { indexer.index(history); @@ -794,10 +798,17 @@ + " : " + item.getRefId() + ", history: " + historyCount); } batchInfo.incrementPosition(); + lastFetchedId = item.getId(); } - logger.debug("size of current batch: " + items.size()); + if(logger.isDebugEnabled()) { + logger.debug("size of current batch: " + items.size()); + logger.debug("last fetched Id: " + lastFetchedId); + } firstResult += batchInfo.getBatchSize(); - if(batchInfo.isComplete() || firstResult > totalSize) { + if(logger.isDebugEnabled()) { + logger.debug("setting firstResult to: " + firstResult); + } + if(batchInfo.isComplete()) { logger.info("batch completed at position: " + batchInfo.getCurrentPosition()); break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |