Expand my Community achievements bar.

Query with SQL2 and AEM6.1

Avatar

Level 2

Hi

I got the following Query: SELECT parent.* FROM [nt:unstructured] as parent INNER JOIN [nt:unstructured] As child1 ON ISCHILDNODE(child1,parent) INNER JOIN [nt:unstructured] As child2 ON ISCHILDNODE(child2,child1) WHERE ISDESCENDANTNODE(parent,'/etc/cargo/csv/bedienpunkte/jcr:content') AND ((name(child1)='Texte' AND name(child2)='de' AND (child2.[BezeichnungNormalized] LIKE '%aef%')) OR (parent.[AliasBahnhofsname1Normalized] LIKE '%aef%') OR (parent.[AliasBahnhofsname2Normalized] LIKE '%aef%') OR (parent.[AliasBahnhofsname3Normalized] LIKE '%aef%') OR (parent.[BahnhofcodeBetrieblich] LIKE '%aef%') OR (parent.[BahnhofcodeKommerziell] LIKE '%aef%'))

If i execute this Query on crx/de i got 4 results which is correct. If i execute the Query with the following java Code, i become for every entry about 33 results. So 4x33 results in java.

Iterator<Resource> components = request.getResourceResolver().findResources(querySQL.toString(), javax.jcr.query.Query.JCR_SQL2);

Could someone help me? What am i doing wrong ?

The Structure is as following:

etc
    cargo
        csv
            bedienpunkte
                jcr:content
                    (NodeWithInfos)

                     -AliasBahnhofsname1Normalized
                     -AliasBahnhofsname2Normalized
                     -AliasBahnhofsname3Normalized
                     -BahnhofcodeBetrieblich
                     -BahnhofcodeKommerziell

                        Texte
                            de

                             -BezeichnungNormalized

0 Replies