drupal-graphql / drupal-graphql/graphql-search-api

Conjunction always using AND inside Condition Groups

Open
#54 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
10
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Hello,

Looks like conjunction inside just below Condition Groups is always taking AND, irrespective of conjunction supplied.

**Main Query**
```
query ($key: [String]!, $offset: Int!, $limit: Int!, $filters: ConditionGroupInput, $sort: [SortInput]) {
searchAPISearch(index_id: "myindex", condition_group: $filters, range: {offset: $offset, limit: $limit}, fulltext: {keys: $key}, sort: $sort) {
count: result_count
documents {
... on MyindexDoc {
group__title
content__content_title
}
}
}
}
```
**Scenario 1 : Supplied query variables (giving expected result)**
```
{
"offset": "0",
"limit": 50,
"key": "test",
"filters": {
"conjunction": "OR",
"groups": [
{
"conditions": [
{
"operator": "=",
"name": "content__content_type",
"value": "article"
},
{
"operator": "=",
"name": "content__field_is_application",
"value": "yes"
},
{
"operator": "<>",
"name": "content__field_life_cycle__entity__name",
"value": "Retired"
}
]
}
]
},
"sort": [
{
"field": "search_api_relevance",
"value": "desc"
}
]
}
```

**Scenario 2 : Supplied query variables (giving expected result)**
```
{
"offset": "0",
"limit": 50,
"key": "test",
"filters": {
"conjunction": "OR",
"groups": [
{
"conditions": [
{
"operator": ">",
"name": "group__id",
"value": "0"
},
{
"operator": "<>",
"name": "group__field_life_cycle__entity__title",
"value": "Retired"
},
{
"operator": "<>",
"name": "group__field_is_live",
"value": "0"
}
]
}
]
},
"sort": [
{
"field": "search_api_relevance",
"value": "desc"
}
]
}
```

**Scenario 3 : Supplied query variables (giving 0 result, but it should be result of Scenario 1 + Scenario 2)**
```
{
"offset": "0",
"limit": 50,
"key": "test",
"filters": {
"conjunction": "OR",
"groups": [
{
"conditions": [
{
"operator": "=",
"name": "content__content_type",
"value": "article"
},
{
"operator": "=",
"name": "content__field_is_application",
"value": "yes"
},
{
"operator": "<>",
"name": "content__field_life_cycle__entity__name",
"value": "Retired"
}
]
},
{
"conditions": [
{
"operator": ">",
"name": "group__id",
"value": "0"
},
{
"operator": "<>",
"name": "group__field_life_cycle__entity__title",
"value": "Retired"
},
{
"operator": "<>",
"name": "group__field_is_live",
"value": "0"
}
]
}
]
},
"sort": [
{
"field": "search_api_relevance",
"value": "desc"
}
]
}
```

What I assume conjunction just above groups always using AND operation between groups objects, but I want to use OR here.
Am I doing something wrong?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.