Have I done something wrong or does Fast Search not allow partial word searching? If i search for "marketing" i get the desired result, but if i search for "market" i get no results.

Is there a special wildcard character that should be used? Obvious things like * and % didn't help.

Comments

douggreen’s picture

Status: Active » Closed (fixed)

Standard Drupal Search (and thus VFS) doesn't do partial word searching. That would be a cool feature, but kinda expensive to do. I think the way most search engines handle this is by doing some natural language conversion between root words and their plurals.

I think that the Fuzzy Search Module (a 2007 Summer of Code project) handles this.

kade’s picture

You may like to check out porter stemmer. It does what you are looking for, ie it reduces a word to its stem, so 'marketing' will become 'market', 'adoption' to 'adopt' etc.

You can find a php class here:
http://www.phpguru.org/static/PorterStemmer.html

davidwhthomas’s picture

Not sure if anyone's still watching this interesting issue, but I got this functionality working by adding a LIKE operator to the query

details here:

http://drupal.org/node/201530

I assume the reason it's not in by default is performance?

Still it works fine for me and results a speedy.

thanks for the great module!

DT

narayan-1’s picture

send me a file to search option

dshelton’s picture

Not that I want to revive an old thread or anything but this is how I fixed it using the core search module.

I came across a duplicate issue here: http://drupal.org/node/498752 and found a patch here: http://drupal.org/files/issues/search.module_17.patch.

It seems people are having issues applying the patch so I manually changed the code in search.module as follows:

line 835: comment out $query2 = substr(str_repeat("i.word = '%s' OR ", count($arguments2)), 0, -4); and add: $query2 = substr(str_repeat("i.word like '%%%s%%' OR ", count($arguments2)), 0, -4);

line 861: comment out return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%% %s %%'", $num_new_scores, $num_valid_words); and add: return array("d.data ". ($not ? 'NOT ' : '') ."LIKE '%%%s%%'", $num_new_scores, $num_valid_words);

line 1188: comment out $boundary = '(?:(?<=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .'])|(?=['. PREG_CLASS_SEARCH_EXCLUDE . PREG_CLASS_CJK .']))'; and add: $boundary = '';

Obviously you could delete the old lines of code but I prefer to keep them there just in case. I've had great success with this, it's fast, and it doesn't appear to break anything. I'm running 6.20. My props to the original patch designer.

dfdavis’s picture

If you don't want to hack into the core search module, you can create you own search module using the hook_search.

drupalfan81’s picture

Issue summary: View changes

Just updated to latest version of drupal as of 4.26.2014 and this custom core search hack is still working. Thanks!

drupalfan81’s picture

Hey dshelton,

Since you came up with this hack, I wanted to ask...do you know if I will experience any decrease in speed/performance by making this hack?