[4.0] Fixing several issues in com_finder/Smart Search#29428
[4.0] Fixing several issues in com_finder/Smart Search#29428wilsonge merged 4 commits intojoomla:4.0-devfrom
Conversation
fixing several issues, esp Postgres
|
@alikon Could you have a look on the You can find it here: I tried it already, and to me it seems to be wrong, but I dont know how it was intended to work. The I don't really understand what shall be achieved with this ... maybe you can give me a help? Even it if shall not be solved with this PR, but maybe we can solve it soon? |
|
That is not the only place we are adding to the having clause. |
|
@Hackwar I am busy with real job now, so won't have time before tonight or weekend, but maybe you can test following. Can you test if this works on PostgreSQL and verify if it delivers the same result on MySQL as the existing stuff does? |
|
as this pr fix the index from backend in postgresql + more clean code + etc....
@richard67 i'm in your same shoes here..... better @Hackwar can explain us "what shall be achieved" with that query // Iterate through each taxonomy group.
for ($i = 0, $c = count($groups); $i < $c; $i++)
{
$query->having('SUM(t.node_id IN (' . implode(',', $groups[$i]) . ')) > 0');
}smells wrong, but , again i still don't understand the goal of that query .... |
|
I have tested this item ✅ successfully on 6a0cc68 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29428. |
|
@Hackwar Yes, I think the last change was it. LGTM. |
|
The whole having clauses thing is related to making the query performant and making sure that all taxonomies and terms are included in the query result. We have taxonomies like author, category, tags and we have the search phrase. The search phrase splits up into its terms and for each term we can have several hits in the terms table with stemmed terms, etc. In 4.0 I rewrote this to only join once for the taxonomies and once for the terms mapping table. In the where clause we restrict the result set down to whatever matches to any of the matching terms (so it matches not just to "Joomla", "awesome" and "release", but also to only "Joomla", only "awesome" and only "release") and then in the having clause, we require that it has to have at least one match for every term group. For this, we do a SUM() over the checks if the taxonomies or terms are in the results and if that is >0, we are good. And while I'm writing all this, I found the solution for this and now it all works. Woohoo! Please test both for MySQL and Postgres, also with more complex searches. |
|
@alikon Could you test it again? Thanks in advance. |
|
while testing i've found some issues with bytea and Gather Search Statistics enabled |
|
Merged both. Good catch. |
|
@alikon Well, even if it was your fix: Could you test again so we have it counted on GitHub as a good test, too? It resets the counter after a new commit. |
|
I have tested this item ✅ successfully on 24e8633 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29428. |
|
I have tested this item ✅ successfully on 24e8633 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29428. |
|
rtc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29428. |
|
@alikon @richard67 what I don't know enough about postgres is the |
|
for what i can tell you we should be covered by: |
|
Thanks! |
Smart Search right now is broken for Postgres. This doesn't fix everything, but I hope with these issues fixed, solving the other issues should become easier.
Clearing where without bounded
In the frontend, we are clearing most of our query at one point in time. However with the parameterized queries, this fails since the bound parameters are still present. So we have to clear that one as well.
Unfortunately now, the search in frontend still doesn't work with Postgres, since it fails on the HAVING clause. If someone can help here, that would be good.This should be solved now.Indexing doesn't work in Postgres
In the code for the postgres indexing, a bunch of errors have crept in. This fixes those and while doing just that, I noticed something: The code is identical except for just a few lines, so we can thus drop the whole db driver system and simplify the code a lot.
@wilsonge Can we merge this without fixing the frontend search completely? I hope that I can find someone who can fix this when they see the whole code...