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:
You will use the following operations in this topic:
| Type | Operation | Description |
|---|---|---|
| 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.
- 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 - In the Query Variables Pane, enter the
hubIdobtained from the Retrieve Hubs tutorial.Query Variables
{ "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7" } - 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 2 - Perform a Free-Text Search
Free-text search allows you to find objects by matching keywords across common fields such as names and part numbers. This is useful when you have partial information or want to explore the hub contents.
- In Manufacturing Data Model Explorer, enter the following query in the Query Pane:
Query
query SearchByHub($hubId: ID!) { searchByHub( hubId: $hubId searchCriteria: { query: "Cup" } ) { pagination { cursor pageSize } results { name score matches { matchedPropertyId matchedText } searchResultObject { __typename ... on Component { id } ... on Model { id } ... on DesignItem { id } ... on Folder { id } } } } }Show More - In the Query Variables Pane, enter the
hubId.Query Variables
{ "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7" } - Click Play. The response displays matching objects with their names, relevance scores, and match details.
Response
{ "data": { "searchByHub": { "pagination": { "cursor": null, "pageSize": 5 }, "results": [ { "name": "Cup", "score": 1410.252, "matches": [ { "matchedPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjplZDE1MzVlNGM5M2M0ZWQzOTU3YTA1MmU1NmRjMzE3My0xLjAuMA", "matchedText": "Cup" } ], "searchResultObject": { "__typename": "DesignItem", "id": "urn:adsk.wipstg:dm.lineage:nP1nOY0WTq2_nnadCvlx9w" } }, { "name": "Cup", "score": 449.92102, "matches": [ { "matchedPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjozN2Q0Y2NiMzA2Njg0NzE0YWYyMmExZjMwZDI5YzMzNi0xLjAuMA", "matchedText": "Cup component" } ], "searchResultObject": { "__typename": "Component", "id": "cHJvZHVjdH45YWJNY0Z4S2doUHljd3VNb2FHTmlrX0wyQ35NeWpwUUR6Q3YwdFZQQzBYMVRhUVdPX2FnYQ" } } ] } } }Show More
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.
- 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 - In the Query Variables Pane, enter the
hubIdand thematerialPropertyIdobtained from Step 1.Query Variables
{ "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7", "materialPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA" } - 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.
- 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 - In the Query Variables Pane, enter the
hubId.Query Variables
{ "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7" } - 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 objectsMODEL- Model objectsFILE- 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.
- 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 - In the Query Variables Pane, enter the
hubIdandpropId. ThepropIdis apropertyDefinition.idvalue 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 } - 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.
- 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 - In the Query Variables Pane, enter the
hubIdandmaterialPropertyId.Query Variables
{ "hubId": "urn:adsk.ace:beta.scope:02dd340f-3e84-4db8-b6a1-56a964a202c7", "materialPropertyId": "cHJvcGRlZn5RbUZ6WlZCeWIzQmxjblJwWlhOVGRHRm5hVzVuflNXNTBjbWx1YzJsalVISnZjR1Z5ZEdsbGMwZHliM1Z3VTNSbn5SMlZ1WlhKaGJBfnBhcmFtZXRlcnMuUW1GelpWQnliM0JsY25ScFpYTlRkR0ZuYVc1bjo4MmVjZDZkZjA5NDg0YmQzYmFhZTRiY2ZiNGRhM2NjYS0xLjAuMA" } - 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
searchFieldsentry are OR’ed together. MultiplesearchFieldsentries are AND’ed together. - Sorting requirements: Sorting requires a valid searchable property ID obtained from the
searchablePropertiesByHubquery. - Relevance scoring: The
scorefield indicates relevance and is useful when searching across multiple object types.