Comments (6)
Hi @eric-schmidt ,
That syntax doesn't look correct.
You're missing the groups.
For example:
condition_group:{
groups:[
{
conjunction:OR
conditions:[
{name: "node_type", value: "course", operator: "="},
{name: "node_type", value: "scholarship", operator: "="},
]
}
{
conditions:[
{name: "gid", value: "2", operator: "="}
]
}
]
}
Let me know if that helps.
from graphql-search-api.
@duartegarin I've amended my query to the following; however, now I'm getting an Internal server error instead of results:
{
allResults: searchAPISearch(
index_id: "sitewide"
range: {start: 0, end: 12}
condition_group: {
groups: [
{
conjunction: OR
conditions: [
{name: "field_archive_date", value: "NULL", operator: "="},
{name: "field_archive_date", value: "2019-03-18", operator: ">="},
]
}
{
conditions: [
{name: "content_type", value: "resource", operator: "="}
]
}
]
}
sort: {field: "created" value: "desc"}
facets: [
{operator: "=", field: "product", limit: 0, min_count: 0, missing: false}
{operator: "=", field: "resource_type", limit: 0, min_count: 0, missing: false}
{operator: "=", field: "segement", limit: 0, min_count: 0, missing: false}
{operator: "=", field: "solution", limit: 0, min_count: 0, missing: false}
]
) {
result_count
documents {
... on SitewideDoc {
nid
field_archive_date
}
}
facets{
name
values{
count
name: filter
}
}
}
}
No syntax errors are highlighted in the query, so perhaps the problem lies elsewhere 🤔
from graphql-search-api.
Hi @eric-schmidt ,
What error? Maybe there is a bad condition in there?
You can turn on debug mode to see whats happening.
Add this in your development.services.yml file, under parameters:
graphql.config:
result_cache: false
schema_cache: false
development: true
from graphql-search-api.
@duartegarin Cool snippet! I'm now getting the following verbose error: Call to a member function getResultItems() on null
. I believe it is stemming from the line {name: "field_archive_date", value: "NULL", operator: "="}
, as when I swap that out for something else (e.g. checking on nid), I don't get the error. Is that the correct way to check for a field that does not have a value set?
It's also worth noting that field_archive_date
is a Date field, perhaps that's not playing nice with the condition groups. {name: "field_archive_date", value: "NULL", operator: "="}
does work fine when within non-grouped conditions.
from graphql-search-api.
Hi @eric-schmidt ,
Sincere apologies for the late reply on this, it seemed to slip through the cracks.
I just tested it with a date field and had no issues.
Here is my query:
{
searchAPISearch(index_id:"anabranch_connect_index", conditions:[{name: "applications_close_date", value: "NULL", operator: "="}, {name:"type", value:"career_opportunity"}]){
documents{
... on AnabranchConnectIndexDoc{
type
applications_close_date
}
}
result_count
}
}
Did you manage to work this out?
from graphql-search-api.
As I can't reproduce and no response for a while I'm making this closed. Feel free to reopen if need be.
from graphql-search-api.
Related Issues (20)
- How to filter for an active facet? HOT 5
- Conflicts with multiple indexes HOT 6
- Expose search_api_relevance score to query HOT 5
- Taxonomy conditions not working with default search api database HOT 1
- Search Highlight Processor HOT 2
- Using keys return "Internal server error" HOT 2
- Is it compatible with graphql 4.x version ? HOT 12
- Facets with Language HOT 2
- D9 readiness HOT 1
- Not equal to (<>) operator on condition does not allow for NULL value HOT 6
- Mulitvalued custom field results are incomplete HOT 1
- Warning when $condition_group_arg['groups'] is NULL/not an array in addConditionGroup() HOT 1
- Add configurable cache max age to GraphQL Search API query results HOT 4
- resolveValues will error out if query has a fatal error
- How to get facets through GraphQL Search API ? HOT 1
- Sort the result set by relevance HOT 11
- Drupal 9 support HOT 3
- work with drupal graphql v4 schema HOT 1
- Conjunction always using AND inside Condition Groups HOT 1
- Graphql v4 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-search-api.