Searching and Filtering
Learn how to effectively search and filter data in the Duro API using our powerful filtering system.
Basic Query Structure
All component searches use this base query structure:
query FilterBOMComponents($filter: ComponentFilter) {
componentSearch(filter: $filter) {
nodes {
id
name
status
}
}
}
Query Parameters
Our GraphQL API supports various filtering options:
query {
components(
first: 10
filter: {
status: ACTIVE
partNumber: { contains: "ABC" }
createdAt: { gte: "2024-01-01" }
}
) {
edges {
node {
id
name
partNumber
}
}
}
}
Available Filters
Text matching (contains, startsWith, endsWith)
Numeric comparisons (eq, gt, lt, gte, lte)
Date ranges
Enum values
Boolean flags
Sorting Results
query {
components(
first: 10
orderBy: { field: CREATED_AT, direction: DESC }
) {
edges {
node {
id
name
createdAt
}
}
}
}
Pagination
We use cursor-based pagination for optimal performance:
query {
components(
first: 10
after: "cursor_value"
) {
pageInfo {
hasNextPage
endCursor
}
edges {
cursor
node {
id
}
}
}
}
Filter Operators
The filtering system supports these operators:
eq
: Exact matchin
: Match any value in an arraycontains
: String containsgte/lte
: Greater/Less than or equalisNull
: Check for null valuesnotIn
: Exclude values in array
Common Search Patterns
1. Manufacturer and Status Filter
Find components by manufacturer and status:
{
"filter": {
"and": [
{
"status": {
"eq": "Prototype"
}
},
{
"manufacturer": {
"name": {
"in": ["Texas Instruments", "Analog Devices"]
}
}
}
]
}
}
2. Date Range and Part Number Filter
Search by CPN and creation date:
{
"filter": {
"and": [
{
"cpn": {
"in": ["CPN-001", "CPN-002", "CPN-003"]
}
},
{
"createdAt": {
"gte": "2023-01-01",
"lte": "2023-12-31"
}
}
]
}
}
3. Category and Name Search
Find components by category and name pattern:
{
"filter": {
"and": [
{
"name": {
"contains": "47uH"
}
},
{
"category": {
"name": {
"eq": "Capacitor"
}
}
},
{
"isModified": {
"eq": true
}
}
]
}
}
Advanced Filtering
The API supports complex logical combinations using and
and or
operators. Here's an advanced example:
{
"filter": {
"or": [
{
"and": [
{
"status": {
"eq": "Design"
}
},
{
"procurement": {
"type": {
"in": ["MAKE", "BUY"]
}
}
}
]
},
{
"and": [
{
"isFavorited": {
"eq": true
}
},
{
"revision": {
"gte": "B"
}
}
]
}
],
"and": [
{
"mpn": {
"isNull": false
}
},
{
"category": {
"name": {
"notIn": ["Top Level Assembly"]
}
}
}
]
}
}
This complex filter demonstrates:
Nested logical operators
Multiple condition groups
Mixed filter types
Exclusion conditions
Best Practices
Start with simple filters and add complexity as needed
Use appropriate operators for better performance
Consider pagination for large result sets
Test complex filters with smaller data sets first
Next Steps
Learn about managing access with Datarooms & RBAC to control who can perform these searches.
Last updated