Search function (numbers)

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Search function (numbers)

Post by panhead » Fri Jan 11, 2019 10:15 am

I've searched the documentation and previous posts but can't find an answer. On my forum members want to search on part numbers that are used in topics. The part number usually is like xxxxx-xx (e.g. 63526-50). The search function truncates the -xx part. Is it possible to make the search function find those numbers without truncating?

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2255
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Search function (numbers)

Post by kinerity » Sat Jan 12, 2019 5:13 am

I suspect there's some other issue with your install. I don't experience this problem on my board. Please fill out the Support Request Template and post it back here to enable us to assist you better.

Edit: I think I see what you mean.
search.png
Kailey Truscott - Community Team

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10933
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: Search function (numbers)

Post by battye » Sat Jan 12, 2019 5:36 am

When I tried it here at phpBB.com it worked okay: search.php?keywords=63526-50&terms=all& ... mit=Search

It brings up this post when I search for that part number. :)
Customisations Team Member

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2255
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Search function (numbers)

Post by kinerity » Sat Jan 12, 2019 5:40 am

Don't we use Sphinx?
Kailey Truscott - Community Team

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10933
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: Search function (numbers)

Post by battye » Sat Jan 12, 2019 6:47 am

Ah good point. Yeah I tried this on my local instance and have the same issue.

It's because of the inbuilt rules I guess:
Place + in front of a word which must be found and - in front of a word which must not be found. Put a list of words separated by | into brackets if only one of the words must be found. Use * as a wildcard for partial matches.
Edit: just a cursory glance, I think perhaps around https://github.com/phpbb/phpbb/blob/68c ... l.php#L215 is where it's happening. I am a shocker with Regex though, so hopefully someone else knows the solution off the top of their head before you need to rely on my deconstructing those regular expressions :lol:
Customisations Team Member

panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Re: Search function (numbers)

Post by panhead » Sat Jan 12, 2019 9:26 am

Thanks for your replies. So the real question is how do you let the search function know xxxxx-xx is one item.

panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Re: Search function (numbers)

Post by panhead » Sat Jan 12, 2019 9:40 am

Does the Sphinx Fulltext search function solve this problem?

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21139
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Search function (numbers)

Post by Mick » Sat Jan 12, 2019 9:44 am

When you want to search for an exact phrase, you can try enclosing the entire phrase in quotation marks. This tells search to search for the precise keywords in the prescribed order. That has been the case for many years. Having said that I tried your search on my vanilla test board and it worked as expected.
"The more connected we get the more alone we become" - Kyle Broflovski

panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Re: Search function (numbers)

Post by panhead » Sat Jan 12, 2019 9:51 am

No luck here, it still ignores the 50 part

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21139
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Search function (numbers)

Post by Mick » Sat Jan 12, 2019 9:55 am

Did you try "63526-50" with the quotes?
"The more connected we get the more alone we become" - Kyle Broflovski

panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Re: Search function (numbers)

Post by panhead » Sat Jan 12, 2019 9:57 am

Yes, with single and double quotes

panhead
Registered User
Posts: 682
Joined: Sat Dec 20, 2003 8:17 pm

Re: Search function (numbers)

Post by panhead » Sat Jan 12, 2019 9:58 am

search:
Attachments
search.jpg
search.jpg (6.22 KiB) Viewed 386 times

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21139
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Search function (numbers)

Post by Mick » Sat Jan 12, 2019 10:09 am

I am getting the ignored thing I must've missed it first time round although it finds the part number fine. It has to be the hyphen causing the problem as suggested earlier.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
battye
Extension Customisations
Extension Customisations
Posts: 10933
Joined: Wed Feb 11, 2004 11:02 am
Location: Australia
Contact:

Re: Search function (numbers)

Post by battye » Sat Jan 12, 2019 2:20 pm

panhead wrote:
Sat Jan 12, 2019 9:40 am
Does the Sphinx Fulltext search function solve this problem?
I'm not sure, but it appears so given it worked here at phpBB.com. This is the code for the Sphinx search: https://github.com/phpbb/phpbb/blob/68c ... x.php#L434

It seems to be a bit smarter out of the box than the MySQL equivalent; on the phpBB side there's certainly a lot less going on.
Customisations Team Member

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 50495
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Search function (numbers)

Post by stevemaury » Sat Jan 12, 2019 4:42 pm

So what does the user need to do to implement that file? Where does it go? What indexes will it work with? Any other changes required?
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

Post Reply

Return to “[3.2.x] Support Forum”