• Resolved westham60

    (@westham60)


    It is my understanding that the basic search function in WP is based on the AND operator, so if I type in two words, it searches post text for posts containing both words. However, mine doesn’t – it very definitely does an OR search for either word. When I set the site up, I assumed this was how it worked, and installed Relevanssi. Having just migrated the site and being told by the IT person doing it that the Relevanssi database had 3 million lines, I felt I needed to revisit the issue, and found that the inbuilt function is supposed to work as an AND search.

    I apologise if this is already answered somewhere, but my search didn’t find anything related. Any thoughts?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • You are right that the built-in search normally requires every search word to match (AND). When it behaves like an OR search, something is usually altering the query — often a search-related plugin or the theme’s own search handling. It is worth noting that Relevanssi itself defaults to OR logic, so what you have been seeing may have come from that rather than core search. A quick test is to temporarily switch to a default theme and turn off search-related plugins, then compare the results before re-enabling them one by one to find the culprit.

    Thread Starter westham60

    (@westham60)

    Thanks for this. Relevanssi is set to AND and does that. If I switch it off, we go back to OR. I switched off two plugins that have a connection to categories along with Relevanssi and still got the OR search.

    I hadn’t thought about the theme, but can’t see anything in its options that has any bearing on it. If it is something deep inside the theme’s code, then I’m stuck with the problem, and would be looking for a less bloaty plugin to replace Relevanssi.

    Thread Starter westham60

    (@westham60)

    I’ve found an alternative (thank you AI for once) with some coding which forces an AND search on the inbuilt WP search to override whatever code elsewhere was turning it into an OR. It works fine, so Relevanssi and its 3 million lines of data is now gone.

    Hi, I realise I am a bit late to the party, and with a somewhat self-serving answer at that (being one of the founders behind the service I am telling you about): I just wanted to let you know about an alternative to Relevanssi that we have developed: SearchCue (plugin, site).

    SearchCue offers AND by default, but a “smart AND” if you will. If the site visitor types a long query for which there isn’t a match, we selectively start dropping the less relevant terms (do look at word frequencies, etc, for this). Thereby we default to giving you matches that include all your words, but then opt for providing meaningful answers rather than no answer if there are no exact matches for all the terms.

    Having just migrated the site and being told by the IT person doing it that the Relevanssi database had 3 million lines

    SearchCue is also a hosted service, so there won’t ever be 3 million lines and no extra load on your database. That being said, I see your 3 million lines are now gone, thank God 🤪

    Happy to answer any questions if you have any, and sorry for barging in on your thread.

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.