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.


       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("Local Name :"+val.getLocalName()+",NamespaceURI :"+val.getNamespaceURI()+
                             ",Prefix String:"+val.getPrefixString());
              if(localName.equalsIgnoreCase("author") ||
                    localName.equalsIgnoreCase("name") )

Local Name :modifier,NamespaceURI :,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={}folder], name={}contains, target class={}base, source role=null, target role=null]
   Required Source Type: {}folder
   Actual Source Type: {}content

   at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(
   at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(
   at org.alfresco.sample.FirstFoundationClient.main(