PDA

View Full Version : Points, underscores, ampersands and slashes


renehaentjens
12-08-2003, 03:00 AM
The PhpDig indexer (I'm using 1.6.5 now) considers words as composed of letters, digits, points, hyphens, underscores, ampersands and slashes.

But when it comes to searching, points, underscores, ampersands and slashes all of a sudden become word separators.

So when a page contains "xxx_yy", this 6-letter-word gets stored as keyword, but when I try to search for "xxx_yy", the search will be for "xxx" and "yy" is ignored as being too short. I can still find the page by searching for "xxx" with "words begin", but not for "xxx_yy" with "exact match".

Why?

(Words with hyphens index and search OK.)

(The documentation states, in "3.2": Words with underscores are included as well...)

Charter
12-08-2003, 01:00 PM
Hi. In search_function.php of PhpDig 1.6.5 just add in those characters that you want to allow into the following line:

$what_query_chars = "[^".$phpdig_words_chars[PHPDIG_ENCODING]." -]+";

Remember to escape 'special' characters. For example, if you want to allow the _ character in searches, then change the above line to the following:

$what_query_chars = "[^".$phpdig_words_chars[PHPDIG_ENCODING]." \\_-]+";