MyBB Community Forums

Full Version: Hyphens in search
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Not sure if this is a bug or just something that was simply left out for a reason. When you search for something that has a hyphen, the search comes back with no results. I've tested it with a thread that contained a hyphen and zero results.
Well, more info would be nice:
1. What's your search input? Also, what type of search is it (entire post or just titles)?
2. What's the title and content of the post that should be found?
3. Do you have fulltext searching enabled in your forum's settings? What's your DB type?
(2014-11-07, 11:13 PM)Destroy666 Wrote: [ -> ]Well, more info would be nice:
1. What's your search input? Also, what type of search is it (entire post or just titles)?
2. What's the title and content of the post that should be found?
3. Do you have fulltext searching enabled in your forum's settings? What's your DB type?


Sorry for being so vague....

1. Not sure what you mean by search input. The search is just titles.

2. The search keyword was Winston-Salem which should have a few results.

3. Fulltext searching is enabled. DB: MySQL 5.5.37 UTF-8 Unicode.


Hope this helps
(2014-11-08, 12:58 PM)SteelCurtain Wrote: [ -> ]1. Not sure what you mean by search input.

The text you're looking for, you specified it below. But you didn't specify 2. - the whole post/title.

(2014-11-08, 12:58 PM)SteelCurtain Wrote: [ -> ]3. Fulltext searching is enabled.

I think this is most likely the cause. Try turning fulltext searching off temporarily and check if that works.
(2014-11-08, 01:10 PM)Destroy666 Wrote: [ -> ]
(2014-11-08, 12:58 PM)SteelCurtain Wrote: [ -> ]1. Not sure what you mean by search input.

The text you're looking for, you specified it below. But you didn't specify 2. - the whole post/title.


(2014-11-08, 12:58 PM)SteelCurtain Wrote: [ -> ]3. Fulltext searching is enabled.

I think this is most likely the cause. Try turning fulltext searching off temporarily and check if that works.

You are correct. When I turned off Fulltext, hyphens are now included in the search.
I believe it is because hyphens are a special character since they can be used to define a range. Try running the query in PHPMyAdmin and have a \ before the hyphen and see if results are correct.
I'm not sure whether we can do much about this if it's a special character. We allow searches with "and" and "or" too afair so special characters aren't escaped.
(2014-11-09, 03:31 PM)dragonexpert Wrote: [ -> ]I believe it is because hyphens are a special character since they can be used to define a range.  Try running the query in PHPMyAdmin and have a \ before the hyphen and see if results are correct.

AFAIR hyphens are not considered word characters at all for some reason and escaping them with \ is not a solution, rather using "" to enclose the whole search phrase. Which will break searches with all special characters/keywords, including and/or mentioned above.

If there's no other easy way to solve this, I guess we can skip this issue. Or just add info about limited allowed word characters to the full text setting's description (it shoud be extended with proper DB info too, now there's only useless "(depending on your database)"..)
What's with this now? Can we reject this? Anyone else from the team with some input?