This repository was archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor elasticsearch module for modular and extensible filter handling
#6
Merged
pkarw
merged 14 commits into
vuestorefront:master
from
icmaa:feature/refactor-module-for-modular-filter-handling
Apr 9, 2020
Merged
Refactor elasticsearch module for modular and extensible filter handling
#6
pkarw
merged 14 commits into
vuestorefront:master
from
icmaa:feature/refactor-module-for-modular-filter-handling
Apr 9, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Add `applySort` to `SearchQuery` * Add `customFilters` to `buildQueryBodyFromSearchQuery` * Add `or`, `nor` and `nin` filters * Refactor `buildQueryBodyFromSearchQuery` into more modular class
This was referenced Apr 7, 2020
* Pass, use and return `queryChain` filter handler * Set and get `hasCatalogFilters` properly * Check for valid scope before checking value in `applyBaseFilters`
gibkigonzo
reviewed
Apr 7, 2020
gibkigonzo
reviewed
Apr 7, 2020
gibkigonzo
reviewed
Apr 7, 2020
… them mutable in custom- and base-filters * Also make `catalogFilterBuilder` more variable
* Export new class to `body.ts` * Add documentation using JSDoc * Use `for` in `applyBaseFilters` to be able to break it
Author
|
I have tested it a bit now and it seems to work fine. Changes for
Changes for
Changes for
|
gibkigonzo
approved these changes
Apr 8, 2020
Contributor
|
Thanks, this looks great! :) |
This was referenced Apr 8, 2020
elasticsearch module for modular and extensible filter handling [WIP]elasticsearch module for modular and extensible filter handling
1 task
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to the PR #4 (comment) and #3, we decided to give a more extensible approach in adding features to the
storefront-query-builderby doing some refactoring.I refactored the
src/elasticsearch/index.tsand put the logic into a class to make it more read- and extendable. I also added the following features:applySortmethod toSearchQueryto add more complex, custom sorts fromSearchQuerycustomFiltersoption tobuildQueryBodyFromSearchQueryto be able to extendSearchQueryby custom filtersor,norandninfilters tobaseFiltersbuildQueryBodyFromSearchQueryinto more modular class – The goal was to have more readable code and be able to extend the base filter functions in a more logical wayeslintandtypescriptimprovements for better coding experienceThere are some pitfalls and thoughts about backwards compatibility to do yet:
_applySortproperty inSearchQuery– this is really easy to fix, but would appear in each test running against old codecustomFilterscatalog-endpoint-wise without a need to overwrite this endpointapi-search-queryadapter 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
developbranches 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.