Using pathauto can often lead to having classifications of content where all the path does not match the content.
+ $keys = basename($keys);
would work better IMHO.

Comments

zyxware’s picture

Version: master » 6.x-1.x-dev
Assigned: Unassigned » zyxware
Status: Active » Postponed (maintainer needs more info)

Where should I make this change in the code?

Is it for search404_get_keys() function?

Also can you give me an example of the above mentioned scenario so that I can understand it better?

Thank You

Regards
Santhosh Raju

sgriffin’s picture

A user hits a 404 path like http://www.domain.com/photography/architecture/exterior/roman_colliseum

So the key becomes the whole path, so if you moved this content to
http://www.domain.com/photography/travel/roman_colliseum
The search and redirect fails.

If you put the basename function on it and just search on "roman_colliseum", then everything works as expected.

function search404_get_keys() {
line 42

anoopjohn’s picture

Status: Postponed (maintainer needs more info) » Active

Marking as active.

@sgriffin - Can't you just use a regular expression ([^\/]*\/)* for the PCRE filter and get the same effect?

But yes this feature might make sense as a simple checkbox for the user.

sgriffin’s picture

LOL. Quite possibly so if I was a regex expert.
However, for organized paths, it might make sense to fall back or ORS instead of ands to improve results.
By using a basename, for the last url I am stating that it is the only thing that is important and guaranteeing a proper redirect.
Im not exactly sure what it is searching on or if it is using and..
Is it doing a search for "photography && architecture && exterior && roman_colliseum"?
I think it's more logical to search for "photography || architecture || exterior || roman_colliseum"

In any case, I'm quite happy with this module, its a major benefit for drupal!
Thanks for the good work!

zyxware’s picture

Status: Active » Fixed

The module only passes on the keys to Drupal Search (or other search modules) to perform the actual search. There is already an option in the module to add OR operator in between the keywords. The default drupal search uses implicit AND between keywords.

Marking issue as fixed since the feature is already present in some form.

Status: Fixed » Closed (fixed)

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