No Code Attached Yet bug
avatar prinswebdevelopment
prinswebdevelopment
20 Apr 2023

Steps to reproduce the issue

  • enable smart search content plugin

  • add category with subcategories

  • add articles with content to subcategories

  • create filter en select only subcategories (not the parent category)

  • add smart search module with that filter

  • search on frontend and result is as aspected

  • change filter and add parent category (do not unset the subcategories)

  • try to search, you havo no results

Expected result

I expect to find the articles

Actual result

No results

System information (as much as possible)

PHP 8.1.2
Joomla! 4.3.0

Additional comments

The problem is in components/com_finder/src/Model/SearchModel.php:getListQuery() row 201
// Iterate through each taxonomy group.
for ($i = 0, $c = count($groups); $i < $c; $i++) {
$query->having('SUM(CASE WHEN t.node_id IN (' . implode(',', $groups[$i]) . ') THEN 1 ELSE 0 END) > 0');
}

This result in een AND like this:

HAVING
SUM(CASE WHEN t.node_id IN (15) THEN 1 ELSE 0 END) > 0
AND SUM(CASE WHEN t.node_id IN (16,17) THEN 1 ELSE 0 END) > 0
AND SUM(CASE WHEN m.term_id IN (9) THEN 1 ELSE 0 END) > 0

But I think the AND must be an OR like this:

HAVING
(SUM(CASE WHEN t.node_id IN (15) THEN 1 ELSE 0 END) > 0
OR SUM(CASE WHEN t.node_id IN (16,17) THEN 1 ELSE 0 END) > 0)
AND SUM(CASE WHEN m.term_id IN (9) THEN 1 ELSE 0 END) > 0

The last AND with m.term is add in row 311 of the same file.

avatar prinswebdevelopment prinswebdevelopment - open - 20 Apr 2023
avatar joomla-cms-bot joomla-cms-bot - change - 20 Apr 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Apr 2023
avatar richard67 richard67 - change - 20 Apr 2023
Labels Added: bug
avatar richard67 richard67 - labeled - 20 Apr 2023
avatar pixelhexe
pixelhexe - comment - 20 Apr 2023

Seems to be the same bug as described already here:

#38201

In my opinion the issue was set to "closed" by mistake.

avatar alikon
alikon - comment - 20 Apr 2023

it's not closed by mistake, but because there is a pull request #39751

so if it is the same issue please close this one and test #39751

avatar prinswebdevelopment
prinswebdevelopment - comment - 21 Apr 2023

pull request #39751 solves the problem. Thanks! This one can close.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40434.

avatar prinswebdevelopment prinswebdevelopment - change - 21 Apr 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-04-21 13:21:05
Closed_By prinswebdevelopment
avatar prinswebdevelopment prinswebdevelopment - close - 21 Apr 2023

Add a Comment

Login with GitHub to post a comment