Closed cewald closed 4 years ago
I have tested it a bit now and it seems to work fine. I needed to make some changes at the API and VSF to make it work.
Changes for vue-storefront
- https://github.com/DivanteLtd/vue-storefront/pull/4234:
SearchQuery
objectapi-search-query
search-adapter to support new storefront-query-builder
sortingnpm
version of storefront-query-builder
Changes for vue-storefront-api
- https://github.com/DivanteLtd/vue-storefront-api/pull/429:
bodybuilder
package to 2.2.21
to be able to use the clone
methodnpm
version of storefront-query-builder
Changes for storefront-api
- https://github.com/DivanteLtd/storefront-api/pull/51
bodybuilder
package to 2.2.21
to be able to use the clone
methodnpm
version of storefront-query-builder
I will open up two PR's in the repos and connect this ticket. ✔
Thanks, this looks great! :)
In order to the PR https://github.com/DivanteLtd/storefront-query-builder/pull/4#issuecomment-609625727 and #3, we decided to give a more extensible approach in adding features to the
storefront-query-builder
by doing some refactoring.I refactored the
src/elasticsearch/index.ts
and put the logic into a class to make it more read- and extendable. I also added the following features:applySort
method toSearchQuery
to add more complex, custom sorts fromSearchQuery
customFilters
option tobuildQueryBodyFromSearchQuery
to be able to extendSearchQuery
by custom filtersor
,nor
andnin
filters tobaseFilters
buildQueryBodyFromSearchQuery
into more modular class – The goal was to have more readable code and be able to extend the base filter functions in a more logical wayeslint
andtypescript
improvements for better coding experienceThere are some pitfalls and thoughts about backwards compatibility to do yet:
_applySort
property inSearchQuery
– this is really easy to fix, but would appear in each test running against old codecustomFilters
catalog-endpoint-wise without a need to overwrite this endpointapi-search-query
adapter in the Vue Storefront will need some small updates for the new sorting optionsSo it would be a good idea to manage this changes under a new version number to support older systems by the current version and just use this version from the current VSF/API
develop
branches on as a new version.This is currently in progress and not much tested – but please give me some feedback if I don't head in a completely wrong direction.