Update of /var/cvs/contributions/lucene/src/org/mmbase/module/lucene
In directory james.mmbase.org:/tmp/cvs-serv24689
Modified Files:
Lucene.java
Log Message:
sometimes we get events on nodes not actually changed. Don't update indices
then. What that happened may be another issue
See also:
http://cvs.mmbase.org/viewcvs/contributions/lucene/src/org/mmbase/module/lucene
Index: Lucene.java
===================================================================
RCS file:
/var/cvs/contributions/lucene/src/org/mmbase/module/lucene/Lucene.java,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -b -r1.128 -r1.129
--- Lucene.java 12 Feb 2009 12:34:11 -0000 1.128
+++ Lucene.java 12 Feb 2009 13:51:13 -0000 1.129
@@ -48,7 +48,7 @@
*
* @author Pierre van Rooden
* @author Michiel Meeuwissen
- * @version $Id: Lucene.java,v 1.128 2009/02/12 12:34:11 michiel Exp $
+ * @version $Id: Lucene.java,v 1.129 2009/02/12 13:51:13 michiel Exp $
**/
public class Lucene extends ReloadableModule implements NodeEventListener,
RelationEventListener, IdEventListener, AssignmentEvents.Listener {
@@ -1104,7 +1104,12 @@
}
break;
case Event.TYPE_CHANGE:
+ if (event.getChangedFields().size() > 0) {
+ // I don't know why the event was issued in the first
place, but don't make it
+ // worse.
+
scheduler.updateIndex("" + event.getNodeNumber(),
MMBaseIndexDefinition.class);
+ }
break;
case Event.TYPE_DELETE:
scheduler.deleteIndex("" + event.getNodeNumber(),
MMBaseIndexDefinition.class);
@@ -1225,6 +1230,8 @@
public abstract class Assignment implements Runnable, Delayed {
+
+ private final Throwable cause = new Throwable(); // store a stack
trace
private final int id = assignmentIds++;
private final long endTime = System.currentTimeMillis() +
Lucene.this.waitTime;
@@ -1252,6 +1259,10 @@
return new Date(endTime - Lucene.this.waitTime);
}
abstract String idString();
+
+ public Throwable getCause() {
+ return cause;
+ }
}
void assign(Assignment a) {
if (assigned(a)) {
@@ -1314,8 +1325,12 @@
current = indexer;
int updated = indexer.updateIndex(number, klass);
if (updated > 0) {
+ if (log.isDebugEnabled()) {
+ log.debug(indexer.getName() + ": Updated "
+ updated + " index entr" + (updated > 1 ? "ies" : "y"), getCause());
+ } else if (log.isServiceEnabled()) {
log.service(indexer.getName() + ": Updated " +
updated + " index entr" + (updated > 1 ? "ies" : "y"));
}
+ }
current = null;
}
}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs