× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
g
3
3
2
J
2
p
2
m
2
h
2
s
2
r
2
d
2
l
2
a
2
New Topic  
Spiros Spiros
wrote...
Posts: 4
Rep: 0 0
2 years ago
I wonder how did you manage to solve this bug in the forum? (I have an SMF forum myself.)
Read 924 times
7 Replies

Related Topics

Replies
wrote...
Educator
2 years ago
Hi Spiros

The logic we used was if the string length is less than 2 characters long, we set its value to empty. Thus, when the search is conducted, the word isn't included in the search query.

Does that make sense?
Spiros Author
wrote...
2 years ago
Thanks, bio_man!

Do you have the code edits available? Not a programmer so I could not figure it out myself -:)
wrote...
Educator
2 years ago
In
Code:
Search.php

Locate
Code:
elseif ($smcFunc['strlen']($value) < 2)

Within the {, remove the code inside and replace it with:

Code:
$value = '';
unset($searchArray[$index]);

See if that helps
Spiros Author
wrote...
2 years ago
Wow, such a simple thing and they have not changed it in default SMF! Thanks a million!
wrote...
Educator
2 years ago
No problem. It is taxing on the server to search all instances of words that are two characters long. So I think there's a reason for that madness 😄
Spiros Author
wrote...
2 years ago Edited: 2 years ago, Spiros
You mean all instances of words that are less than two characters long? But they could simply be skipped/removed from the query before it is passed to the search function.

I see here I get:

Quote
"Search tip: Word's that are one character in length are automatically omitted, unless the "phrase is quoted".

Do you use the same code change?
wrote...
Educator
2 years ago
Actually, the code you implemented simply disables the error. You could even remove the $value = ''; and it'll still work.
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1169 People Browsing
 120 Signed Up Today
Related Images
  
 1385
  
 204
  
 361
Your Opinion