View Full Version : How To Index One-Character Words

01-19-2004, 06:40 AM
I just started using phpDig last night. Looks like I've finally found a decent website search engine that I can live with! :D

I'm wondering though how I can set it up so that even single character words are indexed. I found the following statement in the config.php file, which I think would govern that.
define('SMALL_WORDS_SIZE',2); When I set that number to zero, it sure didn't like that. Is there any way to disable the small words exclusion? Thanks in advance for your help.

01-19-2004, 07:08 AM
Hi. Not tested, but perhaps try the following.

Comment out the following line in the phpdigEpureText function located in the phpdig_functions.php file:

$text = ereg_replace('[[:blank:]][^ ]{1,'.$min_word_length.'}[[:blank:]]',' ',' '.$text.' ');

Also comment out the following chunk of code in the search_function.php file:

while (ereg(' ([^ ]{1,'.SMALL_WORDS_SIZE.'}) | ([^ ]{1,'.SMALL_WORDS_SIZE.'})$|^([^ ]{1,'.SMALL_WORDS_SIZE.'}) ',$test_short,$regs)) {
for ($n=1; $n <=3; $n++) {
if ($regs[$n]) {
$ignore .= "\"".$regs[$n]."\", ";
$test_short = trim(str_replace($regs[$n],"",$test_short));

Then set define('SMALL_WORDS_SIZE',2); to define('SMALL_WORDS_SIZE',0); in the config file.

01-19-2004, 11:08 AM
Worked like a charm! Thanks very much for your help. :)