Global Search (Basic and Advanced)

Contentstack’s Search functionality allows you to look for any assets or entries located within a particular stack. This search function can be used through the search bar located on the header of the Contentstack app.

You can perform two types of searches—Basic and Advanced—depending on your requirements.

  • Basic Search: It is a full-text search that checks for the searched phrase in all the fields of the entries or assets. It provides limited filters and is ideal for a quick search.
  • Advanced Search: It is a field-level search, with the ability to perform combined, complex search queries. It supports ANY (i.e., OR) and ALL (i.e., AND) operators, and is ideal when searching for very specific pieces of content.

For Basic Search, you can just navigate to the search bar in the header tab and quickly type in your search keywords to bring up results. To use Advanced Search functionality, you can click on the Advanced button to bring up the Advanced Search page. Once you land on this page, enter in specific field-related queries to get relevant results.

Let’s look at how to use the two types of searches.

Basic Search

Basic Search is a full-text search. This means that it compares every word of your search phrase with all the values used in all the fields of entries or assets. It then sorts the results based on a robust algorithm created to provide the best-matched results first.

Note: You can use the Entries or Assets option from the drop-down menu located in the left corner of the search bar to narrow down your search results.

Select Entries or Assets.jpg

These options will help switch between results specific to assets or entries, based on your requirement.

Running a quick search

Consider a scenario where you are looking to quickly bring up all the entries that contain the name “John Smith” within their fields.

Perform the following steps:

  1. Navigate to the search bar located on the header tab of the Contentstack site.
  2. Select the Entries option from the left-hand side drop-down menu, based on your requirement.
    Select Entries.jpg
  3. Type in the keywords “John Smith” and press the Enter key.

The system will display all the entries of your stack that contain the term “John Smith”.

Let us take a look at how we can further refine the search results using the filters.

Using filters

Contentstack offers a few filters that can be used to further refine search results. The availability of these filters changes depending on whether it is an entry-specific or asset-specific search. Let us understand these search filters.

Search Filters for Entries

Contentstack offers the following filters for entry-specific searches:

  • Content Types
  • Publish Status
  • Tags

Let us understand how to implement these filters.

Content Types

A quick search will directly look through all the content types for the keywords mentioned in the search bar by default. To search for entries within a specific content type, perform the following steps:

  1. Click on the drop-down arrow located beside Content Types.
    Select Content Type.jpg
  2. Select the required content types from the drop-down list.
  3. Click on Apply to apply the filter to the current search result. The search results will be refined according to the content type chosen.
  4. Once done with your search, you can click on Reset to clear the filter.
    Select Reset.jpg

Publish Status

The Publish Status filter helps you refine the search results based on the published status of the entries. You can search for specific keywords within entries published in a specific environment.

Perform the following steps to use this filter:

  1. Click on the drop-down arrow located beside Publish Status.
    Select Publish Status.jpg
  2. Select the publishing environments within which you need to search for the keywords.
  3. Click on Apply to apply the filter to the current search results. The search results will be refined according to the publishing environment chosen.
  4. Once done with your search, you can click on Reset to clear the filter.
    Select Publish reset.jpg

Tags

The Tags filter allows you to refine the search results based on the specific tags assigned to your entries. Perform the following steps to use this filter:

  1. Click on the drop-down arrow located beside Tags.
    Select tags.jpg
  2. Select the tags you need to run your search on from the drop-down list.
  3. Click on Apply to apply the filter to the current search results. The search results will be refined based on the tags you chose in the drop-down list.
  4. Once done with your search, you can click on Reset to clear the filter.
    Select tags reset.jpg

You are free to toggle between any of these search filters to derive the search results you want. You can also apply multiple filters at the same time to match your specific needs. When done with your search, you can also click on CLEAR FILTER to clear all the filters applied.

Clear filters.jpg

Search filters for Assets

Contentstack offers the following filters for asset-specific searches:

  • File Types
  • Publish Status
  • Tags

Let us understand how to implement these filters.

File Types

The File Types filter allows you to refine your search results based on the file type of an asset that you are looking for. The file types include audio, PDF, video, image, document, etc. Perform the following steps to use this filter:

  1. Click on the drop-down arrow located beside File Types.
    File Type.jpg
  2. Select the file types that you need from the drop-down list.
  3. Click on Apply to apply the filter to the current search results. The search results will be filtered according to the file types chosen.
  4. Once done with your search, you can click on Reset to clear the filter.
    File Type Reset.jpg

The Publish Status and Tags filters work similar to the way they work for entry-specific searches.

You can apply multiple filters simultaneously to refine your search results. All the filters applied will be visible on the results page at the same time. When done with your search, you can also click on CLEAR FILTER to clear all the filters applied.

Advanced Search

The Advanced option within the search bar lets you perform a field-level search on entries and assets.

You can create multiple search queries (such as Title = Mobile phones, and Price = $200) using our search’s advanced query builder and run them to get the exact piece of content that you are looking for. Multiple queries can be combined using ‘Any’ or 'All' operators. Learn more about this in the latter section.

Advanced Search Thumbnail.jpg

Running Advanced Search

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.
  3. Note: This selector is not available if you choose assets in Step 1.

  4. 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.
  5. 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.

    Condition.jpg
    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.
  6. 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.
    Example:

    • 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.

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

Supported operators for various data types

The following table contains the list of operators available for different fields:

 

Fields Supported Operators
Single Line Textbox (Text) $regex = Contains
Multi Line Textbox (Text) $regex = Contains
Rich Text Editor (Text) Single:
$eq = Matches
$ne = Does not match

Multiple:
$eq = Matches
$ne = Does not match
$regex = Contains
Markdown (Text) Single:
$eq = Matches
$ne = Does not match

Multiple:
$eq = Matches
$ne = Does not match
$regex = Contains
Date (Number) Single:
$eq = Matches
$ne = Does not match
$gt = Greater than
$gte = Greater than or equal to
$lt = Less than
$lte = Less than or equal to

Multiple:
$eq = Matches
$ne = Does not match
Select (Boolean) Single:
$eq = Matches
$ne = Does not match

Multiple:
$eq = Matches
$ne = Does not match
Modular Blocks Not applicable
Group Not applicable
Link Same as Single Line Textbox
Boolean Single:
$eq = Is
$ne = Is not

Multiple:
$eq = Is
$ne = Is not
Number Single:
$eq = Equals
$ne = Does not equal
$gt = Greater than
$gte = Greater than or equal to
$lt = Less than
$lte = Less than or equal to

Multiple:
$eq = Equals
$ne = Does not equal
File Single:
$eq = Is
$ne = Is not

Multiple:
$eq = Is
$ne = Is not
Reference $in = Is
$nin = Is not
Environment tags $in = Is
$nin = Is not
Users $eq = Is
$ne = Is not
Locale $eq = Is

Note: The Matches operator is case-sensitive.

Saved searches

Irrespective of the type of search (Basic or Advanced) that you are performing, you can save your search query.

If your work involves performing a particular set of search queries repeatedly, saving your search saves you a lot of time and efforts. Once you save your search, the next time you simply need to apply the saved search to get the desired results, without building the same queries repeatedly.

To save a search, go to the search results page. You will see a Save search link on the right-hand side, adjacent to the search bar. Click this link, provide a suitable name, and save it.

Save Search.jpg

Once you save a search, it can be found in the Saved Searches section on the extreme right-hand side.

19 saved searches.jpg

You can also find saved searches on the auto-suggest drop-down of the search bar in the header.

Saved searches from header.jpg

To edit a search’s name, click the edit icon.

Edit saves search.jpg



Note: Saved searches are user specific. This means that your saved searches are visible only to you. They are not available to any other users of your stack or organization.

Limitations

There are certain limitations that we have applied for Advanced Search. Let’s understand what they are:

  • You can add a maximum of 20 search queries while running an advanced search
  • While running an Advanced Search, you can add only one level of nested condition. This means that you cannot add a nested condition within a nested condition. 
  • You save a maximum of 10 searches. To save more, you will have to delete existing ones.
Was this article helpful?
top-arrow