Problem/Motivation

We should port the "facet filters" from d7 facets + facet api bonus. We're renaming the "facet filters" to "facet processors" for more clarity on what the processors can do.

Remaining tasks

Create a new Processor that implements the \Drupal\facetapi\Processor\BuildProcessorInterface and makes sure specified terms are only displayed when they are at the deepest level. This can be implemented by removing them from the $results array.

- This doesn't need a config form.

Comments

borisson_ created an issue. See original summary.

tom verhaeghe’s picture

Assigned: Unassigned » tom verhaeghe
tom verhaeghe’s picture

There is no getChildren() method in the \Drupal\facetapi\Result\Result class. I'd implement this, but right now I can't even debug this because saving facets doesn't work properly yet (error and page breaks). So I'm waiting until this works again ...

borisson_’s picture

Issue tags: -Novice +Needs committer feedback

We need to figure out how to add the children for a result and how to implement ::getChildren

borisson_’s picture

Status: Active » Postponed
Issue tags: -Needs committer feedback

Removing tag, was discussed in the facetapi hangout of 09/11.

I opened a new issue that we should fix before we can continue work on this. Postponed this issue on that one #2612078: Facet children

borisson_’s picture

Version: » 8.x-1.x-dev
Related issues: +#2807333: Implement hierarchical structures in facets

I think we can work on this more once #2807333: Implement hierarchical structures in facets is in.

borisson_’s picture

Status: Postponed » Active

The hierarchy is in - back to active.

tom verhaeghe’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

I've created ShowOnlyDeepestLevelItemsProcessor loosely based on what I found in the facetapi_bonus processor with the same name.

borisson_’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This has to be the longest time between assigning an issue and uploading a first patch for it :-) Thanks so much! This will need a test but at first glance this looks great!

+++ b/src/Plugin/facets/processor/ShowOnlyDeepestLevelItemsProcessor.php
@@ -0,0 +1,36 @@
+ *   id = "show_only_deepest_level_items_processpr",

This looks like a typo (/s/processpr/processor/)

tom verhaeghe’s picture

StatusFileSize
new1.25 KB
new742 bytes

I was blocked by the other issue ;-)

Fixed the typo

tom verhaeghe’s picture

Status: Needs work » Needs review
j3ll3nl’s picture

How is this working for you. For me the logic of creating the hierarchy is (#2807333) is being run before this build code comes in. This results in an empty facet because of the missing children.

extravioar’s picture

I'm trying to understand how it all works:
why is hierarchy handled if a separate "if statement" in class DefaultFacetManager (line 310)

// Handle hierarchy.
    if ($results && $facet->getUseHierarchy()) {
    [...]
}

and not as a new Processor at STAGE_BUILD

foreach ($facet->getProcessorsByStage(ProcessorInterface::STAGE_BUILD) as $processor) {
   [...]
}
borisson_’s picture

Assigned: tom verhaeghe » Unassigned
Status: Needs review » Needs work

Back to needs work, we need to really have tests before we commit this.

borisson_’s picture

Status: Needs work » Needs review
StatusFileSize
new2.69 KB
new3.17 KB

Start of tests.

brentg’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch and works for me. (used search_api and database search)
Scheduled the patch for a new testing since it has been a while.

Edit: looks like patch has failed and will need work. Fail related to http://cgit.drupalcode.org/facets/commit/?id=6cbf1565e6db9ede510dbc81a5a...

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: create_facet_processors-2598304-15.patch, failed testing. View results

brentg’s picture

Status: Needs work » Needs review
StatusFileSize
new3.2 KB
new1.15 KB
borisson_’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.