# Problem with searching plurals (with apostrophe)

**URL:** <https://www.ruby-forum.com/t/problem-with-searching-plurals-with-apostrophe/120364>\
**Category:** Ferret\
**Created:** [November 16, 2007, 8:04am UTC](https://www.ruby-forum.com/t/problem-with-searching-plurals-with-apostrophe/120364 "2007-11-16T08:04:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jags](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@jags](https://www.ruby-forum.com/u/jags)\
**Post date:** [November 16, 2007, 8:04am UTC](https://www.ruby-forum.com/t/problem-with-searching-plurals-with-apostrophe/120364/1 "2007-11-16T08:04:30Z")

</div>

hello guys,

i am using acts\_as\_ferret plugin(0.4.1 Latest) with ferret gem(0.11.4  
Latest)  
on rails 1.2.5 and ruby 1.8.6(UBUNTU Gutsy)  
i have this  
:Stores Model  
acts\_as\_ferret :fields =\> {:name =\> { :boost =\> 2 ,:store =\> :yes},  
:short\_desc =\> { :boost =\> 1.5,:store =\>  
:yes },  
:tag\_list =\> {:boost =\> 1 },  
:name\_for\_sort =\> {:index =\> :untokenized}  
}

and i search using this code in my Stores controller

@products = Store.find\_by\_contents params[:q].to\_s.upcase+“\*”

for e.g i have a Stores with name as  
“benhank’s coffee outlet”

when i search for “benhank” i get the resultant store as expected.  
but when i search with param as “benhank’s” or “benhanks” —  
i dont get anyresults.  
atleast i shud have got the result for search with “benhank’s”  
which is actually what is entered in :name field

how can i get this done. pls help  
i have been trying to understand to use the analysers and tokenisers  
but couldn’t get through.also looking at wildcardquery and fuzzy  
things

thanks  
jags

```
  ____________________________________________________________________________________

```

Be a better sports nut! Let your teams follow you  
with Yahoo Mobile. Try it now.  
[http://mobile.yahoo.com/sports;\_ylt=At9\_qDKvtAbMuh1G1SQtBI7ntAcJ](http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ)

---

<div class="post-metadata">

**Author:** ![jags](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@jags](https://www.ruby-forum.com/u/jags)\
**Post date:** [November 16, 2007, 10:26am UTC](https://www.ruby-forum.com/t/problem-with-searching-plurals-with-apostrophe/120364/2 "2007-11-16T10:26:51Z")

</div>

Hi,

your problem is pretty much analyzers and tokenization related, so you  
really should understand what happens there.

Tried the Ferret short cut pdf book from o’reilly?

In general you’ll need a stemming analyzer to strip plural endings from  
words. Regarding the “'” - it’s a question of the tokenizer you’re using  
whether the 's ending is considered to be part of the word it follows,  
or ‘s’ is interpreted as a term of it’s own.

Cheers,  
Jens

On Thu, Nov 15, 2007 at 10:56:12PM -0800, Jagdish rao wrote:

> :yes },
> 
> thanks  
> Ferret-talk mailing list  
> removed\_email\_address@domain.invalid  
> [http://rubyforge.org/mailman/listinfo/ferret-talk](http://rubyforge.org/mailman/listinfo/ferret-talk)

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa
