data-hub
data-hub copied to clipboard
Filter query type based on FilterDefinition objects - Work in Progess
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 inEcommerceFrameworkBundle- [ ] 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 theUnionTypeto allow multiple types as input failed so far.
- [ ] 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:
- [ ] Refactor
EcommerceFrameworkBundleto allow accessing the field name fromAbstractFilterType. Currently we use scope hijacking inHijackAbstractFilterType::getFieldFromFilter()to call the necessary but protected methods.
see also https://github.com/pimcore/pimcore/issues/3537 I like the idea, need to have a detailed look at it though,
Any update here?
@fashxp ping @julmot could you resolve the conflict please ?
@fashxp any updates ?
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 fyi: We're already using this PR in an integration stage successfully (with the enhancements das-peter just merged).