• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Why Xenforo searches by titles with "AND" instead of "OR"?

Moshe1010

Well-known member
#1
I'm wondering why XF built in search, and even Elastic Search, search titles by the combination of "AND" instead of "OR".

If I try to search right now a phrase based on titles only: "XCache PHP" (without the quotes)
It would search XCache AND PHP --> Only if these two words are in the title, it would find the thread.

However, on any other software that I've encountered so far, it searches with "OR", meaning if I search by titles only, it would search if the title has either XCache or PHP and would give me the output of any of them.

Thus, I'm wondering why this is working like this since it's making the search engine really ineffective.
(Not sure if this is the right place for this thread, but it does create a huge hassle with some search-based add-ons).
 
Last edited:

Mike

XenForo developer
Staff member
#2
You can switch it to OR if you want, but frankly, I don't think I've seen any software that is OR by default. Google is effectively AND by default.
 

Moshe1010

Well-known member
#3
You can switch it to OR if you want, but frankly, I don't think I've seen any software that is OR by default. Google is effectively AND by default.
How can I switch to OR? Google is AND only if you search with quotes. If you don't search with quotes it's OR by default.
vB 4 works the same way, as well as Sphinx.
 

Mike

XenForo developer
Staff member
#4
Use "|" between words.

Quotes is a phrase search. It means those words in exactly that order. This is different than an AND search.

Google does AND by default, see here: https://support.google.com/websearch/answer/136861
If you want to search for pages that may have just one of several words, include OR (capitalized) between the words. Without the OR, your results would typically show only pages that match both terms.
 

Moshe1010

Well-known member
#5
Use OR between words.

Quotes is a phrase search. It means those words in exactly that order. This is different than an AND search.

Google does AND by default, see here: https://support.google.com/websearch/answer/136861
Yes, but you can't really search for titles on Google, so if you search X+Y, it can find X on the title and Y in the content or the page (or even URL). Try to search on any big vB 4 (or even 3) board, and you will see that it breaks the phrase to OR by default. It's much more effective that way (in my opinion of course) to search with OR when it's based on titles since there is much smaller chance that both (or more) of your words appear in a single title.

About using OR, do you mean instead of "XCache PHP" to use "XCache OR PHP"? based on title search only, it gives me the same result.
 

Moshe1010

Well-known member
#7
Yes "|" works - "OR" doesn't. Is there anything written about that or is that something that everybody knows?
I've never seen anything like this, and it may help to add this to the FAQ or something like this (if it's not there yet).

Thanks for the help - I would still suggest doing it by default, but that's your call.