I couldn't see anything in the module or issue queues, but having a way to explode the path using specific characters would be awesome.

User-case, clean URL's use hyphen replacement for spaces.

/my-fat-cat

Which literally searches for "my-fat-cat" as a single word

Quick hack to the Search404Controller::search404GetKeys() made the results search for everything :)

return str_replace('-', ' OR ', $keys);

which searches for "my OR fat OR cat", and starts to return useful results.

I can't see the feature, so opening as a support request in case it is there, otherwise, a feature request for white space substitution replacements.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alan D. created an issue. See original summary.

idiaz.roncero’s picture

Totally support this. I am using a SearchAPI view for searchs, and hyphens make Search404 useless (the view interpret the @keys as a single word, not AND or OR keywords) Can use SearchAPI filters, though, but it would be useful to have this option also on Search404

pradeeshrajd’s picture

You can still achieve this without any modifications in the module. Please enable the option 'Use OR between keywords when searching' under the advanced setting section. If that is not the case please make your requirement little more clear.

chippyjacob’s picture

@pradeeshrajd yes it works for me.

When I enable the option 'Use OR between keywords when searching' under the advanced setting section, each word in a sentence is searched seperately.

akhilavnair’s picture

Status: Active » Fixed

Hi All,

Based on the comment from #3 and #4, issue seems fixed.

Thanks.

Status: Fixed » Closed (fixed)

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

nrambeck’s picture

Using the advanced " OR " option does not work for me.

When I enter the URL "/my-fat-cat", I get a resulting search for "my-fat-cat" instead of "my fat cat". I don't really want the OR at all just to replace the hyphens with spaces. In my case, I'm using the Custom Search Path feature. I think that may have something to do with the problem.

froboy’s picture

I'm having the same issue as in #7. We have a custom search path too and are using Search API Solr as our search backend. I'm wondering if the OR isn't getting passed to non-core searches?

joshua.boltz’s picture

I'm facing this same issue using Search API Solr and the "OR" setting in Search404.
If i have a URL like
https://demo.ddev.site/search?search=two-words

It performs a search for `two-words`, whereas I need it to perform a search for `two` OR `words`.