PDA

View Full Version : How to include fields from a new table in search?


mohdsoft
12-16-2006, 08:10 AM
Hi,

I have added a new table to the database. Say the name of the table is "table8" and it has the following fields:
id - corresponds to link id in links table
content - where i have text that i want to include in the search

How can i include the content field in the search?

i have looked at this topic
http://www.esyndicat.com/forum/about5980.html
but it is assuming that the field is in links table.

What should i do?

I am using pro version 2.0.1

Thanks in advance

Sergey Ten
12-16-2006, 11:42 PM
Hi, mohdsoft!

Please add your require in the ticket system.

http://www.esyndicat.com/support/desk/

Dave Baker
12-17-2006, 04:50 PM
Hello mohdsoft,
You must connect the table in queries.
If to adhere conditions that you created table "table8" with 2 fields "id_link" and "content".
***Open classes/Dir.php and find function***

function getNumSearchLinks($aWhat = '', $aType = 1)

***In the function find code***

$sql = "SELECT COUNT(t1.`id`) FROM `{$this->mPrefix}links` t1 ";
$sql .= "LEFT JOIN `{$this->mPrefix}link_categories` t2 ";
$sql .= "ON t2.`id_link` = t1.`id` ";
$sql .= "LEFT JOIN `{$this->mPrefix}categories` t3 ";
$sql .= "ON t2.`id_category` = t3.`id` ";

***Below this code add***

$sql .= "LEFT JOIN `table8` t444 ";
$sql .= "ON t1.`id` = t444.`id_link` ";

***In this file find the next function***

function getCause($aWhat, $aType)

***In the function find 3 identical lines of code***

$sql .= "(CONCAT(`t1`.`url`,' ',`t1`.`title`,' ',`t1`.`description`) LIKE '%{$word}%') ";

***Replace each line with the following code***

$sql .= "(CONCAT(`t1`.`url`,' ',`t1`.`title`,' ',`t1`.`description`,' ',`t444`.`content`) LIKE '%{$word}%') ";

***In this file find one more function***

function getLinksBy($aStart = 0, $aLimit = 0, $aCause = '', $aEditor = '')

***In the function find code***

$sql = "SELECT t1.*, `t1`.`comments_active` `comments`, ";
$sql .= "t44.`path` path, t4.`crossed` crossed ";
$sql .= "FROM `{$this->mPrefix}links` t1 ";
$sql .= "LEFT JOIN `{$this->mPrefix}link_categories` t4 ";
$sql .= "ON t1.`id` = t4.`id_link` ";
$sql .= "AND t4.`crossed` = '0' ";
$sql .= "LEFT JOIN `{$this->mPrefix}categories` t44 ";
$sql .= "ON t44.`id` = t4.`id_category` ";

***Below this code add***

$sql .= "LEFT JOIN `table8` t444 ";
$sql .= "ON t1.`id` = t444.`id_link` ";

***Save file***