You don't necessarily have to modify the PhpDig 1.8.7 code to store text in MySQL. Try setting the following in the config file instead:
Code:
define('SUMMARY_DISPLAY_LENGTH',150); //Max chars displayed in summary
define('DISPLAY_SNIPPETS',false); //Display text snippets
define('DISPLAY_SUMMARY',true); //Display description
define('CONTENT_TEXT',0); //Activates/deactivates the
//storage of text content.
In search_function.php of PhpDig 1.8.7, here is some relevant code:
Code:
if (DISPLAY_SUMMARY) {
$table_results[$n]['text'] = htmlspecialchars(phpdigHighlight($reg_strings,preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",ereg_replace('(@@@.*)','',wordwrap($text, SUMMARY_DISPLAY_LENGTH, '@@@')))),ENT_QUOTES);
$table_results[$n]['text'] = phpdigSpanReplace($table_results[$n]['text']);
}
In robot_functions.php of PhpDig 1.8.7, here is some relevant code:
Code:
$db_some_text = preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",implode("",$text));
if (strlen($db_some_text) > SUMMARY_DISPLAY_LENGTH) {
$db_some_text = substr($db_some_text,0,SUMMARY_DISPLAY_LENGTH)."...";
}
$first_words = preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",$titre_resume)."\n".preg_replace("/([ ]{2,}|\n|\r|\r\n)/"," ",$page_desc['content'].$db_some_text)."...";
Note that up to SUMMARY_DISPLAY_LENGTH characters will get displayed in the search results, and that the highlighting of keywords works differently than when storing text in files, so make sure to try a demo before going live.
This was all changed/improved in PhpDig 1.8.8 RC1 so that highlighting can work the same whether or not you store text in files, and PhpDig 1.8.8 RC1 has a TEXT_STORAGE_AMOUNT option so that you can set how much text to store.
If using PhpDig 1.8.8 RC1, you'll probably want the following config options set to store text in MySQL but not files:
Code:
define('DISPLAY_SNIPPETS',true); // display text snippets
define('DISPLAY_SUMMARY',false); // display description
define('SNIPPET_DISPLAY_LENGTH',150); // max chars displayed in each snippet
define('TEXT_STORAGE_AMOUNT',10000); // max characters per page to store in files/tables
define('CONTENT_TEXT',0); // activates/deactivates the storage of text content in files