...
Below are examples of how UniqueQL queries are translated:
UniqueQL | PostgressPostgres | Qdrant |
---|
Code Block |
---|
| const query = {
path: ['id'],
operator: Operator.EQUALS,
value: 1,
}; |
| Code Block |
---|
| SELECT metadata
FROM "public"."Content"
WHERE
jsonb_path_exists(
metadata,
'$ ? (exists(@.id ? (@ == 1)))'
); |
| Code Block |
---|
| {
"key": "metadata.id",
"match": {
"value": 1
}
} |
|
Code Block |
---|
| const query = {
path: ['time'],
operator: Operator.GREATER_THAN,
value: new Date('2025-11-09'),
}; |
| Code Block |
---|
| SELECT metadata
FROM "public"."Content"
WHERE
jsonb_path_exists(
metadata,
'$ ? (
exists(
@.time ? (
@.datetime("YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"") >
"2025-11-09T00:00:00Z".datetime()
)
)
)'
); |
| Code Block |
---|
| {
"key": "metadata.time",
"match": {
"range": {
"gt": "2025-11-09T00:00:00Z"
}
}
} |
|
Code Block |
---|
| const query = {
path: ['diet', '*'],
operator: Operator.NESTED,
value: {
and: [
{
or: [
{
path: ['food'],
operator: Operator.EQUALS,
value: 'meat',
},
{
path: ['food'],
operator: Operator.EQUALS,
value: 'vegis',
},
],
},
{
path: ['likes'],
operator: Operator.EQUALS,
value: true,
},
],
},
}; |
| Code Block |
---|
| SELECT metadata
FROM "public"."Content"
WHERE jsonb_path_exists(
metadata,
'$ ? (
exists(@.diet[*] ? (
(
exists(@.food ? (@ == "meat"))
|| exists(@.food ? (@ == "vegis"))
)
&& exists(@.likes ? (@ == true))
))
)'
); |
| Code Block |
---|
| {
"nested": [
{
"key": "metadata.diet[]",
"filter": {
"must": [
{
"should": [
{
"key": "food",
"match": {
"value": "meat"
}
},
{
"key": "food",
"match": {
"value": "vegis"
}
}
]
},
{
"key": "likes",
"match": {
"value": true
}
}
]
}
}
]
} |
|
Translating UniqueQL to Qdrant Queries
...
Examples
When designing a search or query system for specific use cases, UniqueQL can be applied to create precise queries that match the requirements. Below are examples of how you might structure UniqueQL queries for the use cases you've mentioned:
...