Elxis CMS Forum
Extensions => Bots and plugins => Topic started by: ArXoS on May 04, 2010, 00:49:55
-
Hello Elxis.
I found a strange behavior of search bot, in every version of elxis i made the test
When i use the search bot to make a search of 2 words (Any words or All words) with 2 spaces between them (word1 _ _ word2), the results looks like this
(http://img683.imageshack.us/img683/8002/image1fj.jpg)
When i place 3 spaces between, i get this
(http://img227.imageshack.us/img227/9346/image2vh.jpg)
More spaces, similar behavior. With 1 (normal) space, everything works right.
Two or more spaces can be placed by mistake from a user. Is it possible to normalize this behavior ?
-
I've just made a fresh install of Ubuntu 10.04 and I have not yet installed elxis locally to give a complete answer, but this is propably caused, due to the use of explode() function for splitting the input (search) string into parts with space as delimiter.
To solve this you could use the preg_split() function and use a regular expression to catch multiple spaces between keywods, e.g.:
$keywords = preg_split("/[\s]+/", "search some words");
or even better add the posibility to catch commas:
$keywords = preg_split("/[\s,]+/", "search some large, cool words");
-
Yes, the problem exist if you search for any or all of the words.
To solve the problem open file components/com_search/search.php
Go to line 287 (or somewhere near that - depending on your version) and change this:
$searchwords = explode(' ', $this->searchword);
into this:
$searchwords = preg_split("/[\s]+/", $this->searchword);
Thanks apkoutsou
-
You're a great team. Thank you boys :D :D
Case closed 8)