Custom Search uses element matching with AND operator, as it probably depends upon drupal core SEARCH. Can it be changed to OR operator. On my site of people search more than one element without using OR then search results show nothing, unless there are all the elements in the results.

CommentFileSizeAuthor
#7 custom-search-operator-7.patch1.75 KBjdanthinne
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rliwma’s picture

Priority: Critical » Normal
heddn’s picture

Status: Active » Fixed

I'm taking some liberty but a support request from over a year ago is probably
fixed or irrelevant. If you disagree, please reopen and provide more
details.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tz_’s picture

Version: 6.x-1.x-dev » 7.x-1.0
Status: Closed (fixed) » Active

While this may be an old question, I still wonder the same. Hours of googling and poring over code and admin interface has yielded no help. Switching from AND to OR would be very very helpful.

jdanthinne’s picture

Category: support » feature
dtamajon’s picture

Issue summary: View changes

I agree... changing default behavior from AND to OR can be very helpful.

jdanthinne’s picture

Status: Active » Needs review
FileSize
1.75 KB

Can you try this patch?
There's a new option in the Custom Search config to choose between AND and OR operator.

dtamajon’s picture

I have tested and it's working when using from the search block, but not in results page.

And if you include some words between ", then OR is included inside avoiding any match.

Additionally, maybe should need some work to clean OR when showing results because it's quite odd for a user that the words he entered has changed including 'OR' words in the middle.

jdanthinne’s picture

Status: Needs review » Needs work

I have tested and it's working when using from the search block, but not in results page.

I have to override this form as well then…

And if you include some words between ", then OR is included inside avoiding any match.

Between what? What's the resulting search keywords?

Additionally, maybe should need some work to clean OR when showing results because it's quite odd for a user that the words he entered has changed including 'OR' words in the middle.

Yes, it's just the default behavior of core Search module. I have to override that as well.

dtamajon’s picture

I mean, when you do a search like -->Drupal "Custom Search"<--, the resulting search keywords are -->Drupal OR "Custom OR Search"<--

  • jdanthinne committed 7876d9a on 7.x-1.x
    [#1426140] added: choose between AND and OR for search