knguyen     2005/04/26 10:44:49 CEST

  Modified files:
    core/src/java/org/jahia/services/containers 
                                                ContainerFactory.java 
  Log:
  - due to the delayed time of content indexing, we should not cache container 
search result
  
  Revision  Changes    Path
  1.9       +12 -1     
jahia/core/src/java/org/jahia/services/containers/ContainerFactory.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/containers/ContainerFactory.java.diff?r1=1.8&r2=1.9&f=h
  
  
  
  Index: ContainerFactory.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/containers/ContainerFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ContainerFactory.java     28 Feb 2005 16:10:18 -0000      1.8
  +++ ContainerFactory.java     26 Apr 2005 08:44:49 -0000      1.9
  @@ -60,6 +60,7 @@
   import java.util.BitSet;
   import java.util.Hashtable;
   import java.util.Vector;
  +import java.util.HashMap;
   
   
   /**
  @@ -516,6 +517,9 @@
               } else {
                   customSearcher = cSearcher;
               }
  +
  +            // Due to the delayed time of indexation, we should not cache 
search result
  +            /*
               if (cachedContainerSearcher != null
                   && (cachedContainerSearcher.getQuery () != null)
                   && cachedContainerSearcher.getQuery ().equals (searchQuery)
  @@ -538,6 +542,7 @@
                       }
                   }
               }
  +            */
   
               if (doNewSearch) {
                   /*
  @@ -858,6 +863,7 @@
           // we can do it now that containers are loaded on demand
   
           Vector v = new Vector();
  +        HashMap loadedContainers = new HashMap();
           JahiaContainer thisContainer = null;
           for (int i = 0; i < ctnids.size(); i++) {
               int ctnid = ((Integer) ctnids.elementAt (i)).intValue ();
  @@ -869,6 +875,7 @@
                           cachedContainerListsFromContainers);
                   if (thisContainer != null && thisContainer.getID () != -1) { 
// no read rights on this container
                       v.add(new Integer(ctnid));
  +                    loadedContainers.put(new Integer(ctnid),thisContainer);
                   }
               } catch (Throwable t) {
                   String errorMsg = "Error loading container [" + ctnid + "]";
  @@ -902,11 +909,15 @@
           for (int i = startPos; i < endPos; i++) {
               int ctnid = ((Integer) ctnids.elementAt (i)).intValue ();
               try {
  -                thisContainer = 
ServicesRegistry.getInstance().getJahiaContainersService()
  +                thisContainer = (JahiaContainer)loadedContainers.get(new 
Integer(ctnid));
  +                if ( thisContainer == null ) {
  +                    // should not
  +                    thisContainer = 
ServicesRegistry.getInstance().getJahiaContainersService()
                       .loadContainer( ctnid, loadFlag, jParams, loadVersion,
                           cachedFieldsInContainer,
                           cachedContainerListsFromContainers,
                           cachedContainerListsFromContainers);
  +                }
                   if (thisContainer != null && thisContainer.getID () != -1) { 
// no read rights on this container
                       theContainerList.addContainer (thisContainer);
                   }
  

Reply via email to