MultiDocumentQuery Intersect

veeral jethva asked on July 12, 2022 18:06

How to get result through MultiDocumentQuery with intersect operation.

`<code>`
        string[] cateA = { "X", "Y", "Z" };
        string[] cateB = { "A", "B", "C", "Y", "Z" };

        var query3 = DocumentHelper.GetDocuments()
            .Types(type)
            .WithCoupledColumns()
            .CheckPermissions()
            .AllCultures()
            .OnCurrentSite()
            .Published()
            .NestingLevel(10)
            .InCategories(cateA.ToArray());

            var query1 = DocumentHelper.GetDocuments()
            .Types(type)
            .WithCoupledColumns()
            .CheckPermissions()
            .AllCultures()
            .OnCurrentSite()
            .Published()
            .NestingLevel(10)
            .InCategories(cateB.ToArray());

            var Q4 = query3.Intersect(query1);
`<code>`
Error: System.NotSupportedException: 'The operation is not supported for objects implementing   IMultiQuery interface. Use proper method from IMultiQuery implementation instead.'

Recent Answers


Brenden Kehren answered on July 12, 2022 19:35

What version are you using?

0 votesVote for this answer Mark as a Correct answer

veeral jethva answered on July 13, 2022 19:01 (last edited on July 13, 2022 19:01)

Version: 12.0 (Hotfix: 12.0.96)

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on July 15, 2022 16:29

What I'd suggest in your case is to do a simple node query to get the node and document data without the coupled columns. This makes your query generic and doesn't cause issues later on with the multiple page types. Once you get your 2 lists of node or document ID's, you can do your intersect and get a list of ID's without all the extra data. After you have your list of ID's do a query to get your full data with coupled columns.

There could be an easier way, but this should work until you find that solution.

0 votesVote for this answer Mark as a Correct answer

veeral jethva answered on July 27, 2022 16:13

Thanks Brenden

Let me try

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.