Atom Search
Search atoms using pattern matching and semantic search capabilities.
Query Structureβ
Pattern Matching Searchβ
query SearchAtoms($search: String!, $limit: Int!) {
atoms(
where: {
_or: [
{ label: { _ilike: $search } }
{ data: { _ilike: $search } }
]
}
limit: $limit
) {
term_id
label
image
type
}
}
Semantic Searchβ
query SemanticSearch($query: String!, $limit: Int) {
search_term(args: { query: $query }, limit: $limit) {
atom {
term_id
label
type
image
}
}
}
Interactive Examplesβ
Query
query SearchAtoms($search: String!, $limit: Int!) {
atoms(
where: {
_or: [
{ label: { _ilike: $search } }
{ data: { _ilike: $search } }
]
}
order_by: { created_at: desc }
limit: $limit
) {
term_id
label
image
type
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Search Patternsβ
Case-Insensitive Searchβ
query SearchCaseInsensitive($term: String!) {
atoms(
where: { label: { _ilike: $term } }
limit: 20
) {
term_id
label
}
}
Multi-Field Searchβ
query MultiFieldSearch($search: String!) {
atoms(
where: {
_or: [
{ label: { _ilike: $search } }
{ data: { _ilike: $search } }
]
}
) {
term_id
label
}
}
Filter Search by Typeβ
query SearchPersons($search: String!, $type: atom_type!) {
atoms(
where: {
type: { _eq: $type }
label: { _ilike: $search }
}
) {
term_id
label
}
}
Use Casesβ
Autocompleteβ
const query = `
query Autocomplete($search: String!) {
atoms(
where: { label: { _ilike: $search } }
order_by: { label: asc }
limit: 10
) {
term_id
label
image
}
}
`
// User types "eth" β search for "%eth%"
Global Searchβ
const query = `
query GlobalSearch($search: String!) {
atoms(
where: { label: { _ilike: $search } }
limit: 20
) {
term_id
label
type
}
}
`
Performance Considerationsβ
- Use wildcards sparingly:
%term%is slower thanterm% - Limit results: Always include limit
- Consider semantic search: For natural language queries
Related Patternsβ
- Global Search - Search across all entities
- Best Practices: Performance - Optimize searches
Best Practicesβ
- Use
_ilikefor case-insensitive searches - Add wildcards strategically:
%termorterm%or%term% - Combine with type filters to narrow results
- Limit results to prevent over-fetching