- Posts: 2
COMMUNITY FORUM
Bug? in K2 search Plugin
- Andreas Heckmann
-
Topic Author
- Offline
- New Member
Less
More
9 years 11 months ago #143865
by Andreas Heckmann
Bug? in K2 search Plugin was created by Andreas Heckmann
I tried to activate the "search tags" option. When i did a search on my frontpage a weird sql error appears.
I changed in /plugins/search/k2/k2.php
line 91
to
and from line 104 to $querry
Mainly the %where lines are altered
Now it works for me!
I changed in /plugins/search/k2/k2.php
line 91
to
$quoted = $db->Quote('%'.$escaped.'%', false);
and from line 104 to $querry
if ($phrase == 'exact')
{
$text = JString::trim($text, '"');
$escaped = K2_JVERSION == '15' ? $db->getEscaped($text, true) : $db->escape($text, true);
$quoted = $db->Quote($escaped);
$where = " ( LOWER(i.title) = ".$quoted." OR LOWER(i.introtext) = ".$quoted." OR LOWER(i.`fulltext`) = ".$quoted." OR LOWER(i.extra_fields_search) = ".$quoted." OR LOWER(i.image_caption) = ".$quoted." OR LOWER(i.image_credits) = ".$quoted." OR LOWER(i.video_caption) = ".$quoted." OR LOWER(i.video_credits) = ".$quoted." OR LOWER(i.metadesc) = ".$quoted." OR LOWER(i.metakey) = ".$quoted;
}
else
{
JArrayHelper::toInteger($itemIDs);
$escaped = K2_JVERSION == '15' ? $db->getEscaped($text, true) : $db->escape($text, true);
$quoted = $db->Quote('%'.$escaped.'%', false);
$where = " ( LOWER(i.title) LIKE ".$quoted." OR LOWER(i.introtext) LIKE ".$quoted." OR LOWER(i.`fulltext`) LIKE ".$quoted." OR LOWER(i.extra_fields_search) LIKE ".$quoted." OR LOWER(i.image_caption) LIKE ".$quoted." OR LOWER(i.image_credits) LIKE ".$quoted." OR LOWER(i.video_caption) LIKE ".$quoted." OR LOWER(i.video_credits) LIKE ".$quoted." OR LOWER(i.metadesc) LIKE ".$quoted." OR LOWER(i.metakey) LIKE ".$quoted;
}
if ($pluginParams->get('search_tags') && count($itemIDs))
{
JArrayHelper::toInteger($itemIDs);
$where .= " OR i.id IN(".implode(',', $itemIDs).")";
}
$where .= " )";
Mainly the %where lines are altered
Now it works for me!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 11 months ago #143871
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Bug? in K2 search Plugin
Which version of K2 and Joomla! are you using?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Andreas Heckmann
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 2
9 years 11 months ago #143881
by Andreas Heckmann
Replied by Andreas Heckmann on topic Bug? in K2 search Plugin
K2 : 2.6.9
Joomla: 3.4.1
Joomla: 3.4.1
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Moderator
Less
More
- Posts: 8743
9 years 11 months ago #143904
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Bug? in K2 search Plugin
@Andreas Heckmann
Hi,
This issue has been fixed already for the next release. Can you try with this file ( raw.githubusercontent.com/joomlaworks/k2/master/plugins/search/k2.php ) and let us know ?
Hi,
This issue has been fixed already for the next release. Can you try with this file ( raw.githubusercontent.com/joomlaworks/k2/master/plugins/search/k2.php ) and let us know ?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.