vibez
User
 Platinum Boarder
| Posts: 237 |   | Karma: -1
|
Help adapting a module to work with remostory - 2006/09/15 12:20
Hi,
I am using a module called LiveSearch, which is a kind of ajax search with works very similar to google suggestions.
Unfortunatley it doesnt seem to work well with remository's searchbot. In fact it never indexes the results from it at all 
Below is a snippet of code that I believe is uses to search through joomla content
| Code: | // search content items
$query = "SELECT a.title AS title,"
. "n a.created AS created,"
. "n CONCAT(a.introtext, a.fulltext) AS text,"
. "n CONCAT_WS( '/', u.title, b.title ) AS section,"
. "n CONCAT( 'index.php?option=com_content&task=view&id=', a.id ) AS href,"
. "n '2' AS browsernav"
. "n FROM aliro_content AS a"
. "n INNER JOIN aliro_categories AS b ON b.id=a.catid"
. "n INNER JOIN aliro_sections AS u ON u.id = a.sectionid"
. "n WHERE ( $where )"
. "n AND a.state = 1"
. "n AND u.published = 1"
. "n AND b.published = 1"
. "n AND a.access <= $id"
. "n AND b.access <= $id"
. "n AND u.access <= $id"
. "n AND ( publish_up = '$nullDate' OR publish_up <= '$now' )"
. "n AND ( publish_down = '$nullDate' OR publish_down >= '$now' )"
. "n GROUP BY a.id"
. "n ORDER BY $order"
;
$database->setQuery( $query, 0, $limit );
$list = $database->loadObjectList();
// search static content
$query = "SELECT a.title AS title, a.created AS created,"
. "n a.introtext AS text,"
. "n CONCAT( 'index.php?option=com_content&task=view&id=', a.id, '&Itemid=', m.id ) AS href,"
. "n '2' as browsernav, 'Menu' AS section"
. "n FROM aliro_content AS a"
. "n LEFT JOIN aliro_menu AS m ON m.componentid = a.id"
. "n WHERE ($where)"
. "n AND a.state = 1"
. "n AND a.access <= $id"
. "n AND m.type = 'content_typed'"
. "n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )"
. "n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )"
. "n ORDER BY ". ($morder ? $morder : $order)
;
$database->setQuery( $query, 0, $limit );
$list2 = $database->loadObjectList();
// search archived content
$query = "SELECT a.title AS title,"
. "n a.created AS created,"
. "n a.introtext AS text,"
. "n CONCAT_WS( '/', '". _SEARCH_ARCHIVED ." ', u.title, b.title ) AS section,"
. "n CONCAT('index.php?option=com_content&task=view&id=',a.id) AS href,"
. "n '2' AS browsernav"
. "n FROM aliro_content AS a"
. "n INNER JOIN aliro_categories AS b ON b.id=a.catid"
. "n INNER JOIN aliro_sections AS u ON u.id = a.sectionid"
. "n WHERE ( $where )"
. "n AND a.state = -1"
. "n AND u.published = 1"
. "n AND b.published = 1"
. "n AND a.access <= $id"
. "n AND b.access <= $id"
. "n AND u.access <= $id"
. "n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )"
. "n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )"
. "n ORDER BY $order"
;
$database->setQuery( $query, 0, $limit );
$list3 = $database->loadObjectList();
$searchResult= array_merge( $list, $list2, $list3 );
|
Can you see anyway that the above code could be modified to search through the remository like your excellent searchbot does? I tried reading your searchbot code and adapting it into the above format, but I just ended up with errors.
I can provide the full source code if needed?
Please help as this search module really works well I would like to submit the code to the author, with your consent of course 
Post edited by: vibez, at: 2006/09/15 07:24
|