inside function search_get_where_sql
At start.php of mod/search when the length of the querystring "cars" (4) is >= than $CONFIG->search_info['min_chars'] (4) there are no search results.
What is the reason for this statement?
if (elgg_strlen($query) < $CONFIG->search_info['min_chars'] ) {
$likes = array();
$query = sanitise_string($query);
foreach ($fields as $field) {
$likes[] = "$field LIKE '%$query%'";
}
$likes_str = implode(' OR ', $likes);
$where = "($likes_str)";
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Kevin Jardine@kevin

Kevin Jardine - 0 likes
- Kevin Jardine@kevin

Kevin Jardine - 0 likes
- Kevin Jardine@kevin

Kevin Jardine - 0 likes
- RubenB@RubenB

RubenB - 0 likes
- RubenB@RubenB

RubenB - 0 likes
- ElggHeader@jpound

ElggHeader - 0 likes
- ElggHeader@jpound

ElggHeader - 0 likes
You must log in to post replies.http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html
The MySQL minimum character restriction might be the reason but now I'm a bit confused about that looking at the code you posted.
Actually the section of the code you are quoting explains everything:
// if query is shorter than the min for fts words
// it's likely a single acronym or similar
// switch to literal mode
It would have helped if you hadn't deleted the comments from the code you quoted!
// if query is shorter than the min for fts words
// it's likely a single acronym or similar
// switch to literal mode
Hi Kevin,
The question is: "Why is it that i want to search for 'cars' i cannot switch to literal mode".
It's obvious tha the course is in the MySQL minimum character restriction, but WHY is there a restriction?
Is there a special security reason for it?
Ow, oke...
http://dev.mysql.com/doc/refman/5.1/en/fulltext-fine-tuning.html
:-)
I think I am having a similar problem with search in my Elgg community.
When trying to search for users named "Patrick" I get thse results:
pat = finds all patricks
patr = does not find any results
patrick = finds all patricks.
It is unexpected by the user that "patr" would not bring back results. Does this require mySql fine tuning or can I update my search module somehow?
Thanks in advance for the help.
For my particular problem, it was because the min_chars config variable was set to 4 by default in the search module:
$CONFIG->search_info['min_chars'] = 4;
I am unsure what this does, but I know increasing it to 10 solved all the particular search problems we were experiencing on my site. Now, "patr" returns results including the name "patrick" as a user would expect.