Jump to content

Problem finding pages with find ~=


suntrop
 Share

Recommended Posts

Hi all

I have a search box on my website and the results are somehow opaque :-)

The page I am looking for has a title of: Em Höttche

Search selector is: ~=

"Em" -> no results

"Em Höttche" -> no results

"Em" -> page found

"Höttche" -> page found

It doesn't matter if I use "em h" or "Em H"

I get the exakt same results if I use the search box in PW upper right.

Lister however finds the page in all cases.

Strange thing is, it doesn't seem to be a problem with the special character "ö", because "Höttche" will get you to the correct result.

Front-end search: http://www.biergartenkoeln.de/suchen/?q=Höttche

PW 2.6.0

Link to comment
Share on other sites

Sweet site!

From https://processwire.com/api/selectors/:

The *= and ~= rely upon MySQL fulltext indexes, which only index words of at least a certain length (configurable, but typically 4 characters). They also don't index common English words called stopwords. So while it's preferable to use *= and ~= for their speed, if you aren't getting the results you need, you should consider using %= instead (if you can handle the speed hit).

ProcessWire 3 contains a workaround for this, but you should be able to build it into your search code by checking for such short words and handling them with a the %= operator.

  • Like 1
Link to comment
Share on other sites

Thanks, you should try it if you'r in Cologne :-)

I was aware about the 4 character limit of MySQL, it is set to 3 I think on my server, but I thought it just behaves as it wasn't there at all. Lister was able to find the page, despite using the short word.

I think I can easily update to the upcoming v. 3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...