Title: Search function issue
Last modified: October 5, 2026

---

# Search function issue

 *  Resolved [westham60](https://wordpress.org/support/users/westham60/)
 * (@westham60)
 * [3 days, 7 hours ago](https://wordpress.org/support/topic/search-function-issue-3/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsearch-function-issue-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Carl Peeter](https://wordpress.org/support/users/carlpeeter32/)
 * (@carlpeeter32)
 * [3 days, 7 hours ago](https://wordpress.org/support/topic/search-function-issue-3/#post-19037110)
 * 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](https://wordpress.org/support/users/westham60/)
 * (@westham60)
 * [3 days, 6 hours ago](https://wordpress.org/support/topic/search-function-issue-3/#post-19037141)
 * 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](https://wordpress.org/support/users/westham60/)
 * (@westham60)
 * [3 days, 3 hours ago](https://wordpress.org/support/topic/search-function-issue-3/#post-19037233)
 * 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.
 *  [Sebastian](https://wordpress.org/support/users/spespespe/)
 * (@spespespe)
 * [2 days, 19 hours ago](https://wordpress.org/support/topic/search-function-issue-3/#post-19037445)
 * 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](https://wordpress.org/plugins/searchcue/),
   [site](https://searchcue.com)).
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fsearch-function-issue-3%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Sebastian](https://wordpress.org/support/users/spespespe/)
 * Last activity: [2 days, 19 hours ago](https://wordpress.org/support/topic/search-function-issue-3/#post-19037445)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
