Run Advanced Search | Classic

Contentstack’s Advanced Search feature is accessible from the search bar located in the header of our app. When you click anywhere inside the search bar, an Advanced button will be displayed in the right-hand side corner of the search bar. Clicking on this button will take you to the Advanced Search page where you can enter multiple queries to search for content.

  1. Search entries or assets
    On the Advanced Search page, first, select if you want to search for entries or assets.
  2. Select content type
    If you choose entries, you will see a Content Type selector. You can either select All or a specific content type.

    Note: This selector is not available if you choose assets in Step 1.

  3. Choose between ANY or ALL
    The Any option works like the OR operator. If you select Any, and you enter multiple queries, it will fetch entries or assets that meet any of the given conditions (queries).
    All or Any.jpg
    For example, if your queries are Title = Mobile phones, Price = $200, then it will fetch all entries where Title is Mobile phones and it will also fetch entries where the value of the Price field is $200.

    The All option works like the AND operator. If you select All, and you enter multiple queries, it will fetch all the entries that meet all the specified conditions.
    For example, if your queries are Title = Mobile phones, Price = $200, then it will fetch all entries where Title is ‘Mobile phones’ as well as the value of the Price field is $200. It will not return the entries that satisfy any one condition.
  4. Enter your search queries
    A search query contains a field, an operator, and the expected value.
    Search queries.jpg

    First, select a field (such as Title), then use an operator (such as Matches), and then enter the value that you are looking for (such as Home).

    The field drop-down lets you select a field. If you select All Content Types, in Step 2 above, you will see only system-defined fields here, such as Created at, Created by.
    System defined fields.jpg
    However, if you select a specific content type, you will see the system-defined field as well as actual, user-defined fields of the selected content type (such as Title, URL, Price).

    User defined fields.jpg
    Once you select a field, the next drop-down option lets you select a conditional operator (such as contains, greater than, matches). The values that you can select here depends on the data type of the field that you have chosen.
    For example, if you select Title (which is of ‘string’ data type), you will be able to see operators that support string data type (for example, ‘matches’, ‘contains’). We have covered more about this in the latter section.

    To add multiple search queries, click the + Condition link, and enter your query as explained above.

    Remember that all the conditions or queries that you add on the same level will work with either ‘ALL’ or ‘ANY’ operator, not a mix of both. For example, if you add five queries (without adding a group), all the five queries will be combined using either ALL or ANY, as selected.
  5. Add nested conditions
    Nested conditions help you build really complex queries to further refine your search.
    To add a nested condition, click the + Nested Condition link. You will see a nested block, within which you can select the ‘ALL’ or ‘ANY’ operator.
    Nested Condition.jpg
    This group of queries that you add work as a single bunch along with the parent queries.

    • Title contains ‘My first news article’ AND
    • Price equals to ‘$200’ AND
    • Nested Condition - {City matches 'San Francisco'} OR {City matches 'New York'}

    In the above example, the system will fetch entries that meet the three conditions, i.e., the first two, along with any of the two conditions mentioned in the Nested Condition

Warning: While you can add multiple groups, only one level of nesting is allowed.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page