Search results using "and" instead "or" option

Hi everyone!

I’ve searched but i couldn’t find anything since a couple of years ago.

Is there a way to search by multiple words? I want the users can find related pages that contain word1 AND (&&) word2, otherwise, in my website the results can be too extense and therefore unuseful.

Thank you in advance and regards!

What exactly are you looking to achieve? To search for a complete term consisting of the string “word1 word2” or for pages that contain both words but not necessarily as a single string? Do you need a full text search or do you just want to search in tags? In the latter case, filtering instead of searching would be better suited.

In both cases, you would have to create a custom search function.

See this post for use case 1

I want the users can search for both words but not as a single string. Actually the search should act over a lot of fields: title, main text, tags, city location, author post,…
I achieve to search in those fields, but with multiple words I retrieve results matching only one of the words, and the result become huge and messy.

I’m not sure about the filtering better than searching in this case could work well.

I saw that post but i’m afraid the custom search function only searchs in that example by complete string instead as separated words, and that means users should know exact terms, what i think is difficult in my project.

That’s right, in your case that wouldn’t be the right fit. I just wanted to make sure what the use case is.

But as I said above, you can adapt the current search function by creating your own custom pages method.

Thank you texnixe! i’m going to check it out both links you share with me, and i hope to find a solution :smile: