Welcome! Log In Create A New Profile


Ignore Spaces

Posted by the_goon 
Ignore Spaces
July 19, 2017 12:44PM

My web pages contain the part numbers of certain products, for example ABC 1234.

However, often customers will search for the part number without the space (ABC1234). This always produces no results.

Is there a way to tell Sphider to ignore the spaces in the search?

Re: Ignore Spaces
July 19, 2017 06:32PM
Not to be done on the fly.

Would be no problem to add into …/search.php something like
$query = str_replace(" ", "", $query);
This would delete all blanks inside the query string.

The index procedure will have stored
ABC 1234
as two separate keywords
So the search algorithim will not find a keyword ABC1234.

Now you might think to delete the space also during index procedure. Also no good idea, because all spaces would be deleted. Consequently full text would become one word . . . .

Re: Ignore Spaces
July 20, 2017 08:16PM
Tec is spot on about ignoring spaces in the query string. You would be asking for trouble.

Have you thought about doing the opposite, that is, instead of IGNORING spaces in a search, FORCING a space?

IF your part numbers are ALWAYS exactly three-alpha space four-numeric, then in search.php look for a query string that is EXACTLY seven characters in the format [three alpha][four numeric] and splitting it into [three alpha] SPACE [four numeric].
Sorry, only registered users may post in this forum.

Click here to login