Jump to content

Selector operator *= does not always find a match


Marcel Stäheli
 Share

Recommended Posts

I have a search-page that searches through pages using a search term with the selector operator *= . My problem is that sometimes it finds no results eventhough the term I'm looking for is clearly on several pages. It depends on the search term and I can't find no pattern when it finds something and when not.

If instead of *= I use the operator %= it always find the results as expected with the same search term.

so:
body*=zoe      finds no results
body%=zoe     finds every page

why is that? What exactly is the difference between the two? The documentation just mentions that %= is slower.

I'm running the site on PW 3.0.95, but I also tested it on  3.0.88 with the same behaviour.

Link to comment
Share on other sites

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

Quote

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).

1

 

  • Like 4
  • Thanks 1
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...