Closed janroz closed 9 months ago
Hello. Interesting. I’ll check it out.
Can you share data sample please?
If category record has only one category value:
$data= ['id'=>1,'category'=>1, ...]
,
then it looks like self-filtering works properly.
Results can not contain other categories because of filtering. Thats why self-filtering is disabled by default.
Try to disable self-filtering.
I'll prepare some samples for you today. I need a self-filtering mechanism, as I mentioned earlier, because certain parameters need to work together using an AND operator, not OR. I need to list records that have both X and Y, not records having either X or Y.
I will try to create some examples. I can send you a link to a website where this is implemented, but only in a private message. If you're interested, please contact me.
Shure. Please write me in FB (contacts on my profile)
Do I understand correctly that you would like to be able to enable self-filtering for specific filters and not for all ? Like this:
$filters[] = new ValueFilter('category', [1,4,5]);
$filters[] = (new ValueIntersectionFilter('u', [10,12]))->selfFiltering(true);
$filters[] = new ValueFilter('mount', ['ABC', 'CDE']);
...
$query = (new AggregationQuery())->filters($filters)->countItems();
Exactly!
Great, I'll try to implement it
Simple implementation is ready. You can test it in your case. https://github.com/k-samuel/faceted-search/pull/38 I haven’t had time to cover it well with tests yet. If it’s conceptually suitable, I’ll try to add test cases.
Kirill, it looks very good!
Added a couple of test cases. Didn't reveal any unexpected behavior. Please let me know that in your case everything works as expected. If everything is ok, I’ll make a minor release.
Hi, it works perfectly. I took a closer look at it today. Great job!
Hello Kirill,
I thing I found a bug.
When I have selfFiltering on, filters not returns counts for all possible params.
It works perfectly, it returns counts for all but not the categories that are not selected. Returns counts for category 1,4,5 but not others. When I select some other category, it returns counts for it, for example:
$filters[] = new ValueFilter('category', [1,4,5,6,7]);
it returns counts for 1,4,5,6,7.
I don't know if it is bug or feature. I tried to fix it, but without success. Can you please point me out?