Update of 
/var/cvs/contributions/CMSContainer_Modules/luceus/src/java/com/finalist/cmsc/module/luceusmodule
In directory 
james.mmbase.org:/tmp/cvs-serv29943/luceus/src/java/com/finalist/cmsc/module/luceusmodule

Modified Files:
      Tag: b1_4
        IndexUpdateTask.java 
Added Files:
      Tag: b1_4
        PageAwareCustomContentHandler.java 
Log Message:
CMSC-1179 Added a CustomContentHandler which is aware of the page content a 
content element is being indexed in.


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/luceus/src/java/com/finalist/cmsc/module/luceusmodule
See also: http://www.mmbase.org/jira/browse/CMSC-1179


PageAwareCustomContentHandler.java is new



Index: IndexUpdateTask.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/luceus/src/java/com/finalist/cmsc/module/luceusmodule/IndexUpdateTask.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -b -r1.9 -r1.9.2.1
--- IndexUpdateTask.java        26 Nov 2007 11:42:13 -0000      1.9
+++ IndexUpdateTask.java        9 Dec 2008 11:00:54 -0000       1.9.2.1
@@ -9,6 +9,7 @@
  */
 package com.finalist.cmsc.module.luceusmodule;
 
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -365,14 +366,24 @@
          }
       }
 
-      if (cch != null) {
-         Set<Node> custom = cch.findLinkedContent(contentElement);
+      // Assume there are no custom related elements
+      Set<Node> custom = Collections.emptySet();
+
+      // Then try to find related content, based on the handler implementation 
if any
+      if (cch instanceof PageAwareCustomContentHandler) {
+         PageAwareCustomContentHandler pcch = (PageAwareCustomContentHandler) 
cch;
+         custom = pcch.findLinkedContent(contentElement, pageNode);
+      }
+      else if (cch != null) {
+         custom = cch.findLinkedContent(contentElement);
+      }
+
+      // Finally fields of the custom content to the document
          for (Node customNode : custom) {
             if (module.isDoSecondaryWithPrimary()) {
                LuceusUtil.nodeFields(customNode, doc);
             }
          }
-      }
 
       Indexer idx = module.getIndexer();
       if (idx != null) {
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to