AnsweredAssumed Answered

query sometimes nobody result

Question asked by lameb on Jun 25, 2009
Hi,

I hope for your help.
I have a problem with  "repositoryService.query(store, query, true);"
Sometimes he delivers to me a correct ResultSet, sometimes an empty ResultSet although it no difference in the parametres gives.
In the loop many flows are necessary differently. Besides, especially by the first call there are problems. Then it mostly functions with the first pass.
If somebody can help me?
Many thanks for every tip!




public static Reference getSpace(RepositoryServiceSoapBindingStub repositoryService,Store store,String spaceName) {
   if (repositoryService == null || store == null || spaceName == null || "".equals(spaceName)) {
      log.debug("The service, store or spaceName was null, so the Reference has to be null");
      return null;
   }
      
   String queryStr = "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:'+spaceName;
                Query query = new Query(Constants.QUERY_LANG_LUCENE,queryStr);
       
                ResultSet resultSet = null;
        int count=0;
       
        try {
           while ( count<= 100 ) {         
              QueryResult result = repositoryService.query(store, query, true);
              resultSet = result.getResultSet();
              if(resultSet.getTotalRowCount()==0){
                 System.out.println("ResultSet: "+store + " Durchlauf: " +versuche);
                                  count++;
                                  Thread.sleep(1000); 
                     }
              else
                 count=101;              
           }
        }       
        catch (RepositoryFault e) {
           log.debug("A RepositoryFault occured and null is returned. This might be absolutely correct. For debugging purposes we log the exception though: "+ e);
           return null;
        }
   catch (RemoteException e) {
         log.warn("A RemoteException occured and null is returned. The exception was: "+ e);
         return null;
      }
      catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      
      if (resultSet != null && resultSet.getTotalRowCount() > 0) {
         return new Reference(store, resultSet.getRows(0).getNode().getId(), null);
      }
      else {
         return null;
      }
   }


    repositoryService   RepositoryServiceSoapBindingStub  (id=17)   
       _call   Call  (id=37)   
       attachments   Vector<E>  (id=40)   
       cachedDeserFactories   Vector<E>  (id=42)   
       cachedEndpoint   URL  (id=43)   
       cachedPassword   null   
       cachedPortName   QName  (id=45)   
       cachedProperties   Properties  (id=47)   
       cachedSerClasses   Vector<E>  (id=49)   
       cachedSerFactories   Vector<E>  (id=50)   
       cachedSerQNames   Vector<E>  (id=51)   
       cachedTimeout   Integer  (id=52)   
       cachedUsername   null   
       firstCall   false   
       headers   Vector<E>  (id=57)   
       maintainSession   true   
       maintainSessionSet   true   
       service   RepositoryServiceLocator  (id=60)   
    store   Store  (id=23)   
       __equalsCalc   null   
       __hashCodeCalc   false   
       address   "SpacesStore" (id=72)   
       scheme   "workspace" (id=73)   
    spaceName   "Invoices" (id=26)   
       count   8   
       hash   0   
       offset   0   
       value   char[8]  (id=74)   
    queryStr   "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:Invoices" (id=30)   
       count   60   
       hash   0   
       offset   0   
       value   char[60]  (id=76)   
    query   Query  (id=31)   
       __equalsCalc   null   
       __hashCodeCalc   false   
       language   "lucene" (id=77)   
       statement   "@\\{http\\://www.alfresco.org/model/content/1.0\\}name:Invoices" (id=30)   
    resultSet   ResultSet  (id=35)   
       __equalsCalc   null   
       __hashCodeCalc   false   
       metaData   null   
       rows   ResultSetRow[2]  (id=78)   
       totalRowCount   2   
    versuche   0   
    result   QueryResult  (id=33)

Outcomes