search fooled by hyphens?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
pkas1
Registered User
Posts: 5
Joined: Thu Dec 20, 2012 8:35 pm

search fooled by hyphens?

Post by pkas1 »

If I search for "attributes match" in my phpBB, the search correctly locates posts that contain the string "attributes-match". However, if I search for "attributes-match", the following is reported:

Code: Select all

No posts were found because the word attributes-match is not contained in any post.
Is there a way to support hyphens in searches?

Thanks!
pkas1
User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29312
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Re: search fooled by hyphens?

Post by Marshalrusty »

When the search index is built, it uses some number of delimiters to identify breaks in-between words; spaces are the obvious one, for example. I don't quite remember exactly how this is implemented, but I believe that different search backends can individually define the regular expression used to extract individual words from a block of text.

In any case, '-' is a delimiter, so it considers the word "attributes-match" to be two words, not one. If it were considered to be one, then when you searched for "attributes", "attributes-match" wouldn't match. Of course, it's also possible for "attributes-match" to be added to the index as "attributes-match", "attributes", and "match", but this would require changing some code and then rebuilding the search index.

This could be considered a bug, so if you like, please file a bug report: http://tracker.phpbb.com
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs
pkas1
Registered User
Posts: 5
Joined: Thu Dec 20, 2012 8:35 pm

Re: search fooled by hyphens?

Post by pkas1 »

Thanks -- I will enter a bug report. Interesting, though, is that it doesn't seem to treat the string as two words, in the sense that searching for "attributes match" and "attributes-match" do not return the same results. The first does find posts that contain "attributes-match", but the second does not.

Thanks again,
pkas1
User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29312
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Re: search fooled by hyphens?

Post by Marshalrusty »

Well, what the search backend does to extract words when parsing a post and what the search page does to extract words from a search query are different things. It does, however, seem that the resulting operation is not ideal. Make sure to point all this out in the ticket.
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs
User avatar
AmigoJack
Registered User
Posts: 5932
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: search fooled by hyphens?

Post by AmigoJack »

Thought this was solved with PHPBB3-9749 already. Also read Plus Minus feature in searchbox. Long story short: use dots instead of hyphens.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Locked

Return to “[3.0.x] Support Forum”