find nodes with a specific child association
<p>I am looking for a query (lucene, fts-alfresco or ...) to return all the document which have a specific child association (that is not null).</p>

<p><strong>Some context:</strong>
Documents of type <code>abc:document</code> have a child-association <code>abc:linkedDocument</code>.
Not all document have an other document linked to them, some have none some have one or multiple.</p>

<p>I need a fast and easy way to get an overview of all the documents that do have at least one document linked to them.</p>

<p>Currently I have a webscript that does what I need, but prefer not to have tons of webscripts which are not business related.</p>

<p>code:</p>

<pre><code>        SearchParameters sp = new SearchParameters();
        String query = "TYPE:\"abc:document\"";
        StoreRef store = StoreRef.STORE_REF_WORKSPACE_SPACESSTORE;
        sp.addStore(store);
        sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
        sp.setQuery(query);

        ResultSet rs = services.getSearchService().query(sp);
        List&lt;NodeRef&gt; nodeRefs = rs.getNodeRefs();
        for (NodeRef ref : nodeRefs) {
            List&lt;ChildAssociationRef&gt; refs = services.getNodeService().getChildAssocs(ref);
            for(ChildAssociationRef chref : refs){
            if(chref.getQName().equals(AbcModel.ASSOC_LINKED_DOC)){
                logger.debug("Document with linked doc: {}", ref);
                break;
            }
        }
        }
</code></pre>