Optimized content search exploiting folders

Optimized content search exploiting folders

The following are optimized content's search methods exploiting THRON folders, for each method you will be provided with a sample JSON which must be included in the body of the findByProperties request which can be found within the content package of xcontents. Remember to fill required parameters, sample categories' ids are included within the samples.

 

Let's suppose you have a folder tree made of the following folders:

 

 

  • You might want to retrieve all the content published within the folders tree; if this is the case you have to use the following method:
    {
        "client": {
            "clientId": ""
        },
        "criteria": {
            "linkedCategoryOp": {
                "linkedCategoryIds": [
                    "categoryId1", "categoryId2", "cateogryId3"
                ],
                "cascade": false
            }
        }
    }
    

    This search will return "Content A", "Content B", "Content C", “Content D", "Content E”: all the content within the provided folders. You can use this method to search both on folders within the same tree and on folders belonging to different trees.

  • You might want to retrieve all content within a certain folder within the tree but which are not present in another folder within the tree; if this is the case you have to use the following method:

    {
        "client": {
            "clientId": ""
        },
        "criteria": {
            "linkedCategoryOp": {
                "linkedCategoryIds": [
                    "categoryId2", "!_categoryId3"
                ],
                "cascade": false
            }
        }
    }
    

    This search will return you "Content A" and "Content C”: all the content that are present in Folder 2 but not in Folder 3. You can use this method to search both on folders within the same tree and on folders belonging to different trees.

  • You might want to retrieve all content that are not present in any of the folders provided in the body of the request; if this is the case you have to use the following method:

    {
        "client": {
            "clientId": ""
        },
        "criteria": {
            "linkedCategoryOp": {
                "linkedCategoryIds": [
                    "!_categoryId2", "!_categoryId3"
                ],
                "cascade": false
            }
        }
    }
    

    This search will return you “Content B”: the only content which is neither in Folder 2 nor in Folder 3. You can use this method to search both on folders within the same tree and on folders belonging to different trees.

As you can see in the structure of the request, there is a special parameter: "cascade", which can be set to true in case you want to perform the search recursively in all the sub folders of those included in the "linkedCategoryIds" array.

In case you want to perform a search excluding content which have been moved to trash, you will have to use the following body:

{
    "client": {
        "clientId": ""
    },
    "criteria": {
        "linkedCategoryOp": {
            "linkedCategoryIds": [
                "!__TRASH_"
            ],
            "cascade": false
        }
    }
}

 

Was this article helpful?
1 out of 1 found this helpful

Have more questions?

SUBMIT A REQUEST

Hai altre domande?

INOLTRA UNA RICHIESTA

Comments