Request

Response

    Search Within a Hub

    This topic provides instructions on how to search for Components, Models, Files, and Folders within a Fusion hub using the Manufacturing Data Model API. You will learn how to:

    • Retrieve the list of searchable properties for a hub
    • Perform free-text searches across hub contents
    • Filter search results by specific property values
    • Limit results to specific object types
    • Sort and paginate search results

    As a prerequisite for completing the current topic, you need to complete the following task:

    1. Retrieve Hubs.

    You will use the following operations in this topic:

    TypeOperationDescription
    Query searchablePropertiesByHub Retrieves the list of searchable properties for a hub.
    Query searchByHub Performs a hub-wide search across supported entity types.

    Step 1 - Retrieve Searchable Properties

    Before performing property-based searches, you need to know which properties support searching in your hub. The searchablePropertiesByHub query returns a list of properties that can be used in search filters and sort conditions.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query GetSearchablePropertiesByHub($hubId: ID!) {
         searchablePropertiesByHub(hubId: $hubId) {
            pagination {
               cursor
               pageSize
            }
            results {
               displayName
               propertyDefinition {
                  id
                  name
                  isSearchable
               }
            }
         }
      }
      
      Show More
    2. In the Query Variables Pane, enter the hubId obtained from the Retrieve Hubs tutorial.

      Query Variables

      {
         "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7"
      }
      
    3. Click Play. The response displays a list of searchable properties including their display names and property definition IDs.

      Response

      {
         "data": {
            "searchablePropertiesByHub": {
               "pagination": {
                  "cursor": null,
                  "pageSize": 50
               },
               "results": [
                  {
                     "displayName": "Part Number",
                     "propertyDefinition": {
                        "id": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjpjZTAwOGQ1MjQ2ZGQ0MGFkOTg4MjYwNTkxZTQzNWQxNS0xLjAuMA",
                        "name": "Part Number",
                        "isSearchable": true
                     }
                  },
                  {
                     "displayName": "Name",
                     "propertyDefinition": {
                        "id": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjplZDE1MzVlNGM5M2M0ZWQzOTU3YTA1MmU1NmRjMzE3My0xLjAuMA",
                        "name": "Name",
                        "isSearchable": true
                     }
                  },
                  {
                     "displayName": "Material Name",
                     "propertyDefinition": {
                        "id": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA",
                        "name": "Material Name",
                        "isSearchable": true
                     }
                  }
               ]
            }
         }
      }
      
      Show More

    Note: Save the propertyDefinition.id values from this response. You will need them for property-based searches in the following steps.

    Step 3 - Search by Specific Property Values

    Property-based search allows you to filter results based on specific metadata values. This is useful for structured workflows such as finding all components made of a specific material.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query SearchByHub($hubId: ID!, $materialPropertyId: ID!) {
         searchByHub(
            hubId: $hubId
            searchCriteria: {
               searchFields: [
                  {
                     searchableProperty: $materialPropertyId
                     PropertyQuery: ["Steel"]
                  }
               ]
            }
         ) {
            pagination {
               cursor
               pageSize
            }
            results {
               name
               matches {
                  matchedPropertyId
                  matchedText
               }
               searchResultObject {
                  __typename
                  ... on Component { id }
                  ... on Model { id }
               }
            }
         }
      }
      
      Show More
    2. In the Query Variables Pane, enter the hubId and the materialPropertyId obtained from Step 1.

      Query Variables

      {
         "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7",
         "materialPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA"
      }
      
    3. Click Play. The response displays objects that have “Steel” as their material.

      Response

      {
         "data": {
            "searchByHub": {
               "pagination": {
                  "cursor": "eyJmaWxlT2Zmc2V0IjowLCJjb21wb25lbnRPZmZzZXQiOjEwLCJ0b3RhbEZpbGVFbnRyaWVzIjowLCJ0b3RhbENvbXBvbmVudEVudHJpZXMiOjc3fQ==",
                  "pageSize": 10
               },
               "results": [
                  {
                     "name": "Valve",
                     "matches": [
                        {
                           "matchedPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA",
                           "matchedText": "Steel"
                        }
                     ],
                     "searchResultObject": {
                        "__typename": "Model",
                        "id": "bW9kZWx-OWFiTWNGeEtnaFB5Y3d1TW9hR05pa19MMkN-dUlMMUxWb2FqQXYwSVdFNU94YTVTZF9hZ2E"
                     }
                  },
                  {
                     "name": "Pump",
                     "matches": [
                        {
                           "matchedPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA",
                           "matchedText": "Steel"
                        }
                     ],
                     "searchResultObject": {
                        "__typename": "Model",
                        "id": "bW9kZWx-OWFiTWNGeEtnaFB5Y3d1TW9hR05pa19MMkN-RklmZk1yMG5qSGlwenFTamloVWdRVV9hZ2E"
                     }
                  }
               ]
            }
         }
      }
      
      Show More

    Note: You can search for multiple values within a single property by adding them to the propertyQuery array (e.g., ["Steel", "Aluminum"]). Values within the same property are OR’ed together.

    Step 4 - Filter by Object Types

    You can limit search results to specific object types using the desiredSearchResultTypes parameter. This is useful when you want to find only components, only files, or a specific combination of types.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query SearchByHub($hubId: ID!) {
         searchByHub(
            hubId: $hubId
            searchCriteria: {
               query: "Machine"
               desiredSearchResultTypes: [COMPONENT]
            }
         ) {
            results {
               name
               searchResultObject {
                  __typename
                  ... on Component {
                     id
                     partNumber { value }
                  }
               }
            }
         }
      }
      
      Show More
    2. In the Query Variables Pane, enter the hubId.

      Query Variables

      {
         "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7"
      }
      
    3. Click Play. The response displays only Component objects matching the search criteria.

      Response

      {
         "data": {
            "searchByHub": {
               "results": [
                  {
                     "name": "Espresso Machine",
                     "searchResultObject": {
                        "__typename": "Component",
                        "id": "cHJvZHVjdH45YWJNY0Z4S2doUHljd3VNb2FHTmlrX0wyQ35GMkJWR2xuUnZUY2VCZlExNWtVTkpVX2FnYQ",
                        "partNumber": {
                           "value": "ESP-001"
                        }
                     }
                  }
               ]
            }
         }
      }
      
      Show More

    Available Result Types:

    • COMPONENT - Component objects
    • MODEL - Model objects
    • FILE - File objects (DesignItem, DrawingItem, BasicItem, ConfiguredDesignItem)
    • FOLDER - Folder objects

    Step 5 - Sort and Paginate Results

    For large result sets, you can sort results by a searchable property and use cursor-based pagination to navigate through pages.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query SearchByHub($hubId: ID!, $propId: ID!, $cursor: String) {
         searchByHub(
            hubId: $hubId
            searchCriteria: {
               query: "Component"
               sort: [
                  {
                     propertyId: $propId
                     order: ASC
                  }
               ]
            }
            pagination: {
               cursor: $cursor
               limit: 10
            }
         ) {
            pagination {
               cursor
               pageSize
            }
            results {
               name
               searchResultObject {
                  __typename
                  ... on Component { id }
                  ... on Model { id }
               }
            }
         }
      }
      
      Show More
    2. In the Query Variables Pane, enter the hubId and propId. The propId is a propertyDefinition.id value from Step 1 (such as the Name property). For the first page, omit the cursor or set it to null.

      Query Variables

      {
         "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7",
         "propId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjplZDE1MzVlNGM5M2M0ZWQzOTU3YTA1MmU1NmRjMzE3My0xLjAuMA",
         "cursor": null
      }
      
    3. Click Play. The response displays the first page of sorted results along with a cursor for the next page.

      Response

      {
         "data": {
            "searchByHub": {
               "pagination": {
                  "cursor": "eyJmaWxlT2Zmc2V0IjowLCJjb21wb25lbnRPZmZzZXQiOjEwLCJ0b3RhbEZpbGVFbnRyaWVzIjowLCJ0b3RhbENvbXBvbmVudEVudHJpZXMiOjI1fQ==",
                  "pageSize": 10
               },
               "results": [
                  {
                     "name": "Component1",
                     "searchResultObject": {
                        "__typename": "Model",
                        "id": "bW9kZWx-OWFiTWNGeEtnaFB5Y3d1TW9hR05pa19MMkN-Q3FMajNpdmNMU3FHczRaTXdKUHV4R19hZ2E"
                     }
                  },
                  {
                     "name": "Component2",
                     "searchResultObject": {
                        "__typename": "Model",
                        "id": "bW9kZWx-OWFiTWNGeEtnaFB5Y3d1TW9hR05pa19MMkN-eGhJenJ1UWVyUUh1dExmVWxIRWJxZF9hZ2E"
                     }
                  }
               ]
            }
         }
      }
      
      Show More

    To get the next page: Use the cursor value from the response in your next query’s variables.

    Step 6 - Combine Search Methods

    You can combine free-text search with property-based filtering for more precise results. This is useful when you want to find objects that match both a keyword and specific metadata criteria.

    1. In Manufacturing Data Model Explorer, enter the following query in the Query Pane:

      Query

      query SearchByHub($hubId: ID!, $materialPropertyId: ID!) {
         searchByHub(
            hubId: $hubId
            searchCriteria: {
               query: "Valve"
               searchFields: [
                  {
                     searchableProperty: $materialPropertyId
                     PropertyQuery: ["Steel"]
                  }
               ]
               desiredSearchResultTypes: [COMPONENT, MODEL]
            }
         ) {
            results {
               name
               score
               matches {
                  matchedPropertyId
                  matchedText
               }
               searchResultObject {
                  __typename
                  ... on Component { id }
                  ... on Model { id }
               }
            }
         }
      }
      
      Show More
    2. In the Query Variables Pane, enter the hubId and materialPropertyId.

      Query Variables

      {
         "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7",
         "materialPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA"
      }
      
    3. Click Play. The response displays objects that match both “Valve” in the text and “Steel” as the material.

      Response

      {
         "data": {
            "searchByHub": {
               "results": [
                  {
                     "name": "Valve",
                     "score": 1.0190374,
                     "matches": [
                        {
                           "matchedPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA",
                           "matchedText": "Steel"
                        }
                     ],
                     "searchResultObject": {
                        "__typename": "Model",
                        "id": "bW9kZWx-OWFiTWNGeEtnaFB5Y3d1TW9hR05pa19MMkN-dUlMMUxWb2FqQXYwSVdFNU94YTVTZF9hZ2E"
                     }
                  }
               ]
            }
         }
      }
      
      Show More

    Additional Notes

    • Property filtering logic: Values within a single searchFields entry are OR’ed together. Multiple searchFields entries are AND’ed together.
    • Sorting requirements: Sorting requires a valid searchable property ID obtained from the searchablePropertiesByHub query.
    • Relevance scoring: The score field indicates relevance and is useful when searching across multiple object types.