# Acts\_as\_ferret:: "field-restricted search" possible?

**URL:** <https://www.ruby-forum.com/t/acts-as-ferret-field-restricted-search-possible/131504>\
**Category:** Rails\
**Created:** [March 10, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-field-restricted-search-possible/131504 "2008-03-10T19:26:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [March 10, 2008, 7:26pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-field-restricted-search-possible/131504/1 "2008-03-10T19:26:46Z")

</div>

Can we tell acts\_as\_ferret

- to take up multiple search terms from a form, then
- use each term only on a specific column in the table to search?

I.e.:

- Model: User
- Attributes: firstname, lastname, location, favoritecolor
- Form fields: firstname, lastname, location, favoritecolor

-\> Then let ferret search only in the “firstname column” using only  
“firstname form field (entry)”  
-\> Do this for every form field entry  
-\> Compose the final search result list ?

Wikipedia seems to call that “Field-restricted search”:  
" Some search engines enable users to limit free text searches to a  
particular field within a stored data record, such as “Title” or  
“Author.” "

As far as I have understood, acts\_as\_ferret takes multiple search terms  
and uses them to search the _entire_ created index (meaning all columns  
specified in the model).

Is a “field-restricted search” possible (to speed up the query)? If yes,  
what exactly would I have to do?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [March 10, 2008, 9:09pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-field-restricted-search-possible/131504/2 "2008-03-10T21:09:24Z")

</div>

> Is a “field-restricted search” possible (to speed up the query)? If yes,  
> what exactly would I have to do?
> 
> Thanks for your help!

Found it: YES, “field-restricted search” is possible with this plugin  
(for its query syntax, check out  
[http://lucene.apache.org/java/docs/queryparsersyntax.html](http://lucene.apache.org/java/docs/queryparsersyntax.html))
