How FacetWP works
After adding some facets, you’re asked to click the Re-index button. Indexing is the process of storing facet data into a custom database table. The index table allows FacetWP to retrieve data very quickly.
FacetWP adds one database table:
facetwp_index. This table contains all the information needed to generate the facets. When the “Re-index” button is clicked, FacetWP loops through every post on your site and indexes the values for each facet.
facet_value column is used for permalinks, and the
facet_display_value column contains the label that users see. The values for each row can be modified during the indexing process using the facetwp_index_row filter.
<div class="facetwp-facet facetwp-facet-make facetwp-type-checkboxes" data-name="make" data-type="checkboxes"></div>
Interaction / AJAX
facetwp-template CSS class.
To see lots of useful data, type
FWP into your browser console. Specifically,
FWP.facets is an object containing all active facets and their selected values.
This data is sent to the server via AJAX, and the response is a JSON object containing HTML for the template and HTML for each facet, among other things.
Remember those HTML placeholder elements mentioned before? FacetWP simply injects the response HTML into the appropriate container elements.