# Fuzzy-ness to searches

**URL:** <https://www.ruby-forum.com/t/fuzzy-ness-to-searches/91313>\
**Category:** Ferret\
**Created:** [April 6, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/fuzzy-ness-to-searches/91313 "2007-04-06T17:20:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaserx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@chaserx](https://www.ruby-forum.com/u/chaserx)\
**Post date:** [April 6, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/fuzzy-ness-to-searches/91313/1 "2007-04-06T17:20:07Z")

</div>

Hi. I didn’t notice if topic has already been discussed, but I was  
wondering if there was a way to make ferret match only part of a search  
term. My initial thought was some sort of filter, but I’m unsure of  
where to begin.

An example in the comments of the acts\_as\_ferret tutorial at RailsEnvy  
([http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial](http://www.railsenvy.com/2007/2/19/acts-as-ferret-tutorial)) suggests:  
To return the widest possible array youâ€™d make everything ORâ€™d and  
Fuzzy.

```

@query = params[:search].split(â€ â€œ).collect{|term| term + â€~â€}.join(â€ OR
â€œ)

```

However, the example appears only to work where there are multiple  
search terms separated by a space like “Dark Star” =\> “Dark~ OR Star~”.

Currently, in my basic rails app, ferret will only return results if the  
search term exactly matches what is stored in the DB.

Example.

A search for “MCF” does not match “MCF-7”, but a search for “MCF-7” will  
exactly match the entries with the name “MCF-7” as expected.

Is there a way to get this partial matching behavior with ferret?

Thanks,

Chase

---

<div class="post-metadata">

**Author:** ![chaserx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ec9cab/32.png) [@chaserx](https://www.ruby-forum.com/u/chaserx)\
**Post date:** [April 6, 2007, 5:44pm UTC](https://www.ruby-forum.com/t/fuzzy-ness-to-searches/91313/2 "2007-04-06T17:44:23Z")

</div>

I have, however, noticed that this partial recognition works for longer  
words like colo~ for colon, but not for smaller words as I mentioned  
previously.

-chase
