× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
w
3
w
3
e
3
3
r
3
g
2
2
b
2
M
2
V
2
f
2
c
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 984 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
  441 People Browsing
Related Images
  
 111
  
 4140
  
 206
Your Opinion
What's your favorite coffee beverage?
Votes: 305