-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Faceted search doc #1371
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Faceted search | ||
menuTitle: Faceted search | ||
--- | ||
|
||
# Faceted search | ||
|
||
{{% children %}} |
63 changes: 63 additions & 0 deletions
63
development/components/faceted-search/inside-faceted-search-module.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: Inside the module | ||
weight: 30 | ||
--- | ||
|
||
# Inside the module | ||
|
||
This page should be useful for someone willing to contribute to the module. To do so he/she needs to understand the module logic and structure. | ||
|
||
## Exposed endpoints | ||
|
||
The module | ||
|
||
- is accessible from the front-office on dedicated pages, using hooks | ||
matks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- has a back-office configuration page | ||
- provides 3 endpoints to be regularly visited (by a cron for example) in order to reindex the products | ||
matks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The 3 exposed endpoints are in the root folder of the module. | ||
|
||
Indexation results are stored in specific SQL tables. This allows to query flat tables ready for querying, instead of having complex SQL queries being fired at runtime when user is searching on front-office. | ||
|
||
## Filter system | ||
|
||
On front-office, user can see multiple blocks. Blocks are linked to a filter and the population. The population is the products matching the filter. | ||
|
||
Blocks are what is the most expensive to generate. Each link is a query. | ||
|
||
Filters have a complex structure allowing deep queries such as OR and AND, under, equals, above... and at the end of the processing SQL queries are built from them to be run against the database. | ||
|
||
QUESTION: where are the Filters objects? they are arrays ? | ||
matks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Post processing | ||
|
||
After finding the population matching a filter, a post processing can be applied to alter the data in order to control how it is presented to user. | ||
|
||
For example you might have a collection of prices ranging from 21.88 to 72.82 but this is not nice to display. So you can apply post processing to force the display to be a range from 0 to 100, although the data available goes from 21.88 to 72.82 . | ||
|
||
### Caching | ||
|
||
Filter results are cached inside SQL in order to improve performance. Same query being sent twice can then reuse the result from first fetch. | ||
|
||
|
||
## Highlights of the `src` folder | ||
|
||
### Specific hook structure | ||
|
||
There were so many hooks used in the module that the hook actions have been moved outside of the main file, unlike many other modules. A hook dispatcher is in charge of linking the main module file and calling the right hooks. Hook actions will be found in `src/Hook` | ||
|
||
### MysQL adapter | ||
|
||
Inside `src/Adapter` is the code responsible for mapping faceted search queries to MySQL queries | ||
|
||
### Copy-paste of the Core | ||
|
||
Some of the code inside the module used to be inside the Core repository. It was extracted as it was useful only for the module and this avoids having different behaviors depending on which shop the module was installed. | ||
|
||
## SQL naming | ||
|
||
SQL tables are based on naming convention `layered` because this was the previous name of the module. | ||
|
||
## How it's plugged on the Core | ||
|
||
In the Core front controller ProductListingFrontController a hook is used to check whether a module can provide a SearchProvider. Faceted search module uses this hook to provide its SearchProvider and allow using it. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: Introduction | ||
weight: 20 | ||
--- | ||
|
||
# Introduction | ||
|
||
PrestaShop front-office provides a faceted search capability, powered by the module https://github.com/PrestaShop/ps_facetedsearch/ | ||
|
||
The module allows customers to search for products using multiple filters and mix them. | ||
|
||
It is built on the top of a filtering engine that maps user input to SQL queries. | ||
|
||
INSERT SCREENSHOT | ||
|
||
INSERT A BIT MORE STUFF |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @Hlavtox can you have a look please?