AnsweredAssumed Answered

FTS Search Error

Question asked by sanjaymk on Dec 13, 2010
Hello All -

When doing an Alfresco FTS Search using JAVA Foundation API, I'm getting an error that is a little baffling.  The Search string that is used is pretty simple - "TYPE:\"cm:content\"".  Basically, get all content of type cm:content.  The search itself seems to work fine, but when I try to iterate through the results and print some of the properties of the results, I get an IntegrityException(shown at the end of the post).  I'm only getting this exception with user created content - (.ftl, content created through bulk import, custom model content etc.,). 

What is weird is that, if I run the same search string with the Node Browser I don't get any errors on the UI.

The code itself is pretty straight forward, I modified the Foundation Client JAVA program that comes with the Alfresco SDK to run the search.  Relevant portions of the sample code are shown below.

Any replies or clues are highly appreciated.

Thanks,
Sanjay.



       search = "TYPE:\"cm:content\"";
      
        System.out.println("Search "+search);
        resultSet = searchService.query(storeRef, SearchService.LANGUAGE_FTS_ALFRESCO, search);
        System.out.println("Size : "+resultSet.getNodeRefs().size());
        List<NodeRef> nodeRefs = resultSet.getNodeRefs();
        NodeService nodeService = serviceRegistry.getNodeService();
        String localName = "";
        for(NodeRef nodeRef:nodeRefs)
        {
           Map<QName,?>propMap = nodeService.getProperties(nodeRef);
           
           Set<QName> propKeySet = propMap.keySet();
           for(QName val:propKeySet)
           {
              localName = val.getLocalName();
              System.out.println(val);
              System.out.println("Local Name :"+val.getLocalName()+",NamespaceURI :"+val.getNamespaceURI()+
                             ",Prefix String:"+val.getPrefixString());
              
              
              if(localName.equalsIgnoreCase("author") ||
                    localName.equalsIgnoreCase("name") )
              {
                 System.out.println(localName+":"+propMap.get(val));      
              }
           }
        }




Local Name :modifier,NamespaceURI :http://www.alfresco.org/model/content/1.0,Prefix String:modifier
Exception in thread "main" org.alfresco.repo.node.integrity.IntegrityException: 11130001 Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://SpacesStore/f24ae2c1-a253-4dad-be00-bb33e0855e8a
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}content

   at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(IntegrityChecker.java:661)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:683)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
   at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:347)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:232)
   at org.alfresco.sample.FirstFoundationClient.main(FirstFoundationClient.java:79)

Outcomes