Skip to content
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

Feature/faceting #7

Merged
merged 30 commits into from
Apr 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7a33bfb
add facet types
jakewrfoster Apr 13, 2022
73e6c6f
add field mapping to controller
jakewrfoster Apr 13, 2022
7b1aaa3
map core fields to adapters
jakewrfoster Apr 13, 2022
6b82b23
add DSL
jakewrfoster Apr 13, 2022
633ef4a
add facet parsing, set/get for config, getter for facet data
jakewrfoster Apr 25, 2022
eef0570
add tax aggregations to vip adapter
jakewrfoster Apr 25, 2022
4d5b869
add tag and category aggs to vip adapter, refactor map_* funcs to ada…
jakewrfoster Apr 25, 2022
90dd6c6
add helpers to get facet data and set up facet configs
jakewrfoster Apr 25, 2022
f554db7
add Facet class
jakewrfoster Apr 25, 2022
757937f
phpcs edits
jakewrfoster Apr 25, 2022
e6be068
add generic adapter allow empty search faceting functionality
jakewrfoster Apr 26, 2022
bde4b23
add facet config to controller
jakewrfoster Apr 26, 2022
dd4c75f
move facet dsl to VIP Adapter class, add func to allow empty search f…
jakewrfoster Apr 26, 2022
1ee22ab
add tag and category faceting config setters
jakewrfoster Apr 26, 2022
eed15a1
add args to post tag and category agg functions
jakewrfoster Apr 26, 2022
7a11fd8
add name setter to facet class
jakewrfoster Apr 26, 2022
51bf61a
inject facet name from config into facet class constructor
jakewrfoster Apr 26, 2022
c3c68f7
please phpcs gods
jakewrfoster Apr 26, 2022
c6a7aed
add TODO to README
jakewrfoster Apr 26, 2022
b4ecc47
add TODO to date DSL
jakewrfoster Apr 26, 2022
c34c6ec
add handling for post_tag item query vars, add TODOs
jakewrfoster Apr 26, 2022
e722737
add enable_post_date_aggregation to controller
jakewrfoster Apr 26, 2022
3a9db46
add facet config to tFacet objects
jakewrfoster Apr 26, 2022
2250ce3
add calendar interval to post_date Facet Type class
jakewrfoster Apr 26, 2022
7abadb9
add Post_Date aggs to qp query request args
jakewrfoster Apr 26, 2022
6d974c8
add post_date aggs to adapter
jakewrfoster Apr 26, 2022
c27cdc1
Merge pull request #9 from alleyinteractive/feature/post-date-facets
jakewrfoster Apr 26, 2022
399a9db
update @see tags
jakewrfoster Apr 26, 2022
f006b5e
add phpcs fixes
jakewrfoster Apr 26, 2022
210e417
Merge branch 'main' into feature/faceting
kevinfodness Apr 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add args to post tag and category agg functions
  • Loading branch information
jakewrfoster committed Apr 26, 2022
commit eed15a1407f424c40ff2968328c520543a61f769
11 changes: 6 additions & 5 deletions lib/class-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Controller {
* @param array $args Arguments to pass to the adapter's facet configuration.
* @return Controller The instance of the class to allow for chaining.
*/
public function enable_category_aggregation( array $args ): Controller {
public function enable_category_aggregation( array $args = [] ): Controller {
if ( isset( $this->adapter ) ) {
$this->adapter->enable_category_aggregation();
$defaults = [
Expand Down Expand Up @@ -71,14 +71,15 @@ public function enable_empty_search_faceting(): Controller {
* @param array $args Arguments to pass to the adapter's facet configuration.
* @return Controller The instance of the class to allow for chaining.
*/
public function enable_tag_aggregation( array $args ): Controller {
public function enable_tag_aggregation( array $args = [] ): Controller {
if ( isset( $this->adapter ) ) {
$this->adapter->enable_tag_aggregation();
$defaults = [
'count' => 1000,
'name' => 'Tags',
'startOpen' => false,
'type' => 'post_tag',
'taxonomy' => 'post_tag',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's possible to make this generic per taxonomy - we should be able to pull information about the taxonomy from its slug, so we could do something like enable_taxonomy_aggregation( 'post_tag' ) which would get info about the post_tag taxonomy which would include its label (Tags), and do the same with categories and custom taxonomies, rather than having a special handler for categories and tags.

'type' => 'taxonomy',
];

$args = wp_parse_args( $args, $defaults );
Expand All @@ -93,7 +94,7 @@ public function enable_tag_aggregation( array $args ): Controller {
* @param array $args Arguments to pass to the adapter's facet configuration.
* @return Controller The instance of the class to allow for chaining.
*/
public function enable_post_type_aggregation( array $args ): Controller {
public function enable_post_type_aggregation( array $args = [] ): Controller {
if ( isset( $this->adapter ) ) {
$this->adapter->enable_post_type_aggregation( $args );
$defaults = [
Expand All @@ -117,7 +118,7 @@ public function enable_post_type_aggregation( array $args ): Controller {
* @param array $args Arguments to pass to the adapter's facet configuration.
* @return Controller The instance of the class to allow for chaining.
*/
public function enable_taxonomy_aggregation( string $taxonomy, array $args ): Controller {
public function enable_taxonomy_aggregation( string $taxonomy, array $args = [] ): Controller {
if ( isset( $this->adapter ) ) {
$this->adapter->enable_taxonomy_aggregation( $taxonomy );
$defaults = [
Expand Down