2

I've been trying to Google my way out of this one but I can't seem to find a solid solution for using wildcards by default for the core search module. Only things I can find are patches which aren't really looking like totally stable. And I want my customer's multi-lingual production site to be as stable as possible.

So, the current situation is as follows:

  1. When I search for foo I will get only foo as result.
  2. When I search for foo* I will be getting foo and foobar as result.

What I want is:

When I search for foo I will get foo and foobar, regardless of language.

Is there any way to elegantly solve this. I'm prepared to solve this with a custom module for example.

1 Answer 1

1

I've always used the Porter Stemmer module to handle that, it works a treat.

This module implements the Porter stemming algorithm to improve English-language searching with the Drupal built-in Search module.

The process of stemming reduces each word in the search index to its basic root or stem (e.g. 'blogging' to 'blog') so that variations on a word ('blogs', 'blogger', 'blogging', 'blog') are considered equivalent when searching. This generally results in more relevant search results.

2
  • Hm... that would work if my customer's website would be in English, but it's international: English, Dutch, Spanish, German and French.
    – Ambidex
    Jul 17, 2012 at 9:19
  • 2
    Ah ok. Might be worth looking at how that module does it's indexing, it would give you a good place to start. Bear in mind you're going to be forced to run LIKE xyz% against the database which can get quite inefficient, but without a stemming algorithm you don't have much other choice
    – Clive
    Jul 17, 2012 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.