View Full Version : v1.8.0 strange search result on numbers

05-02-2004, 08:44 PM
I'm pretty desperate...I have a site that has products named things like P1060 etc...searching on P1060 works fine, searching on 1060 returns nothing.

Searching on 1060 P1060 with and operator gives nothing.

Searching on P1060 1060 with or operator gives nothing.

Searching on 1060 P1060 with or operator gives results!!!!

Am i missing the point here? Or are there known bugs with this?
Should I be dropping back to an earlier version of Phpdig? if so which one?
Any help would be greatfully received.


05-02-2004, 08:46 PM
OOOPs I got two examples wrong there....

Searching on 1060 P1060 with and operator gives nothing.

Searching on P1060 1060 with or operator gives results!!!!

Searching on 1060 P1060 with or operator gives nothing at all.

05-03-2004, 12:31 PM
Ok i've noticed something else with further testing. Is it correct that Phpdig only recognises part words if they are the start of the word??

searching for respon will find respond
searching for pond doesn't find respond. hence my problem if people search for the number only 1060 in a part number P1060?????

Could someone clarify this for me.

05-03-2004, 01:39 PM
Hm i think i found my reason, but not an answer...(see quote below).
I tried dropping the mim word size to 1 and then 0 but to no effect.
So does this mean in P1060 the P is a word that is too small to index and the number isn't indexed, and together they aren't considered a word...
I found a site that worked for what i want, but the reference was AAA12345 three letters and the number......


3.2. Full Text Indexing

PhpDig indexes all words of a document, excepting small words (less than 3 letters) an common words, those are definded in a text file.

Lone numbers are not indexed, but those included in words are indexed.

05-03-2004, 04:47 PM
Welcome to the forum, Andrew. We're glad you could join us. :D

Perhaps this thread (http://www.phpdig.net/showthread.php?s=&threadid=146&highlight=numbers) would help. :)

05-03-2004, 05:14 PM
Ok i did a kind of code work around :-/
In the search.php before it does the search....i send the search string to a function and check if its a lone integer, if it is....i prefix my P in front of it and search on "P1060 1060".

Its pretty ugly, cos the search field displays the "P1060 1060". But hey...at least they can definitely search on the product codes now. Oh and I made the search type "any".

function check_int($i) {
// return 0 if not int and return 1 if $i is int
if (ereg("^[0-9]+[.]?[0-9]*$", $i, $p)) {
return 1;
} else {
return 0;
}// end if
}// end check_int

if (check_int($query_string)==1)
$query_string = "P".$query_string." ".$query_string;
$option = "any";
//echo $query_string;
phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse,
$site, $path, $relative_script_path, $template);