Skip to Content Skip to Menu

Integrated Search

  • andyberry
  • andyberry
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 1
18 years 9 months ago #2297 by andyberry
Integrated Search was created by andyberry
Hi!
I've been pulling my hair out trying to build a searchbot that will integrate CB into the core search function of Joomla. I can get it to variously do nothing, or to kill the search function entirely. Either way it's not working. I'm hoping someone can take a peek at the php code and let me know what I'm missing.
Ideally, I want to be able to search by a few fields: firstname, tags, and a member number.

Any help would be appreciated!
Thanks!
-Andy

<?php
/**
* @version $Id $
* @package Mambo_4.5
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$_PLUGINS->registerFunction( 'onSearch', 'botSearchCB' );

/**
* Search method
* @param array Named 'text' element is the search term
*/
function botSearchCB( $text ) {
global $database;

$text = trim( $text );
if ($text == '') {
return array();
}

$database->setQuery( "SELECT firstname AS title,"
. " '' AS created,"
. " cb_tags AS text,"
. " 'Support Info' AS section,"
. " CONCAT('index.php?option=com_comprofiler&task=userProfile&user=',id) AS href,"
. " '2' AS browsernav"
. " FROM #_comprofiler"
. " WHERE firstname LIKE '%$text%' OR cb_tags LIKE '%$text% OR cb_primarysupportcode LIKE '%$text%'"
. " ORDER BY firstname"
);

return $database->loadObjectList();
}
?>

Attachment cb_searchbot.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

  • andyberry
  • andyberry
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 1
18 years 9 months ago #2458 by andyberry
Replied by andyberry on topic Re:Integrated Search
I don't want to double-post this, but should it be in a different forum?:unsure:
-A

Please Log in or Create an account to join the conversation.

  • JoomlaJoe
  • JoomlaJoe
  • OFFLINE
  • Posts: 12
  • Thanks: 0
  • Karma: 14
18 years 8 months ago #2482 by JoomlaJoe
Replied by JoomlaJoe on topic Re:Integrated Search
Okay a couple of things that jump out at me right away. Never done a searchbot myself for mambo/joomla but have seen a few.


andyberry wrote:

$_PLUGINS->registerFunction( 'onSearch', 'botSearchCB' );

Should be
$_MAMBOTS->registerFunction( 'onSearch', 'botSearchCB' );

In your SQL query looks like you are missing one of your underscores.

. " FROM #_comprofiler"

Should be:
. " FROM #__comprofiler"

Hope that helps!

JoomlaJoe *The developer formally known as MamboJoe*
CB Core Team

Please Log in or Create an account to join the conversation.

  • andyberry
  • andyberry
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 1
18 years 8 months ago #2533 by andyberry
Replied by andyberry on topic Re:Integrated Search
Amazing! Thanks!
Those 2 changes now produce results. The links they return, though, are not clickable.
Is there a quick change I can make to allow me to click on the return and have the record displayed? If not I will research.
Thanks again!
-Andy

Please Log in or Create an account to join the conversation.

  • andyberry
  • andyberry
  • OFFLINE
  • Posts: 4
  • Thanks: 0
  • Karma: 1
18 years 8 months ago #2536 by andyberry
Replied by andyberry on topic Re:Integrated Search
Yay:laugh:
In case anyone else is following along, I got it to work (after a fashion). The usernames are stored in the jos_users table and I couldn't getthe Join command to work to pull the data from that table. In the end, I created a new field in CB which acts as the link title. I've attached the searchbot if anyone wants it (just replace the cb_fields with your own.

As a side note, is there anyway to either remove the default fields altogether, or at least make them not required? I don't need them.

Thanks!
-Andy

Attachment fb29415ad24cf882d17ce453116efba8. not found

Attachments:

Please Log in or Create an account to join the conversation.

  • fdx
  • fdx
  • OFFLINE
  • Posts: 1
  • Thanks: 0
  • Karma: 0
17 years 2 months ago #40741 by fdx
Replied by fdx on topic Re:Integrated Search
Andyberry,
I followed your discussion about the integrated search funtion and tried to download your posted file; unfortunately the file download is not possible anymore.
Could you send me the file with the integrated search mambot (and do I need to change the sql tables as well?)?

Thanks a lot,

Frank
(frank.dux at gmx.de)

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum