Giter Site home page Giter Site logo

Comments (6)

duartegarin avatar duartegarin commented on June 27, 2024

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.

eric-schmidt avatar eric-schmidt commented on June 27, 2024

@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.

duartegarin avatar duartegarin commented on June 27, 2024

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.

eric-schmidt avatar eric-schmidt commented on June 27, 2024

@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.

duartegarin avatar duartegarin commented on June 27, 2024

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.

duartegarin avatar duartegarin commented on June 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.