data-hub icon indicating copy to clipboard operation
data-hub copied to clipboard

Filter query type based on FilterDefinition objects - Work in Progess

Open das-peter opened this issue 5 years ago • 7 comments

It would be great to be able to use the GraphQL integration with the IndexService from the EcommerceFrameworkBundle. Currently this pull requests works with following GraphQL Syntax:

{
  getProductFilter(
    fulltext: "Wellness", 
    first: 5, 
    filterDefinition: 133836, 
    facets: [{field: "parentCategoryIds", values: ["72448"]}]
  ) {
    edges {
      node {
        id
        articleNo
        title
        description
      }
    }
    facets{
    	facet {
        field
        label
        options {
          value
          label
          count
        }
      }
    }
    totalCount
  }
}

The query returns the matching nodes as well as the factes defined in the filterDefinition 133836. Return format of the facets:

      "facets": [
        {
          "facet": {
            "field": "parentCategoryIds",
            "label": "Kategorie",
            "options": [
              {
                "value": "71990",
                "label": "parentCategoryIds:71990",
                "count": 119
              },
              {
                "value": "71991",
                "label": "parentCategoryIds:71991",
                "count": 53
              }
            ]
          }
        }

Tasks I'm currently aware of:

  • [x] Fulltext-Search
    • [x] DB
    • [x] Elastic
  • [x] Paging
    • [x] DB
    • [x] Elastic
  • [ ] Support conditions from service configuration
    • [x] DB
    • [ ] Elastic
  • [ ] Support workspace permission checks
    • [x] DB
    • [ ] Elastic
  • [ ] Fix for facet values handling. Currently the FilterService API differentiates strictly between multi / single value filter. However there's no API to properly determine what a FilterType actually supports. So right now we have to make some sort of educated guess in: HijackAbstractFilterType::isMultiValueFilter(). Would need refactoring in EcommerceFrameworkBundle
    • [ ] Allow facet values to be single or multivalue. This could be a workaround for the parent task. If the query has to properly define if a single / multivalue has to be used we could scratch the educated guess. However currently only the multivalue syntax is allowed for the facet value: {field: "parentCategoryIds", values: ["72448"]} instead {field: "parentCategoryIds", values: "72448"} Attempts to use the UnionType to allow multiple types as input failed so far.
  • [ ] Refactor EcommerceFrameworkBundle to allow accessing the field name from AbstractFilterType. Currently we use scope hijacking in HijackAbstractFilterType::getFieldFromFilter() to call the necessary but protected methods.

das-peter avatar Dec 10 '19 04:12 das-peter

see also https://github.com/pimcore/pimcore/issues/3537 I like the idea, need to have a detailed look at it though,

fashxp avatar Dec 12 '19 09:12 fashxp

Any update here?

julkue avatar Feb 19 '20 11:02 julkue

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 24 '20 09:04 CLAassistant

@fashxp ping @julmot could you resolve the conflict please ?

weisswurstkanone avatar Apr 24 '20 12:04 weisswurstkanone

@fashxp any updates ?

weisswurstkanone avatar Jul 03 '20 08:07 weisswurstkanone

Hi, @das-peter , I want to pick this up again. Could you please fix the following error? "Schema must contain unique named types but contains multiple types named "filterFacetArg" (see http://webonyx.github.io/graphql-php/type-system/#type-registry)."

In addition, please merge the master in once more please.

Thanks a lot!

weisswurstkanone avatar Oct 01 '20 14:10 weisswurstkanone

@weisswurstkanone fyi: We're already using this PR in an integration stage successfully (with the enhancements das-peter just merged).

julkue avatar Oct 01 '20 20:10 julkue